r99485 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99484‎ | r99485 | r99486 >
Date:15:46, 11 October 2011
Author:catrope
Status:ok
Tags:
Comment:
1.18wmf1: MFT r99484
Modified paths:
  • /branches/wmf/1.18wmf1/includes/api/ApiQueryAllUsers.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/includes/api/ApiQueryAllUsers.php
@@ -234,11 +234,13 @@
235235 ApiBase::dieDebug( __METHOD__,
236236 'MediaWiki configuration error: the database contains more user groups than known to User::getAllGroups() function' );
237237 }
 238+
 239+ $lastUserObj = User::newFromName( $lastUser );
238240
239241 // Add user's group info
240242 if ( $fld_groups ) {
241 - if ( !isset( $lastUserData['groups'] ) ) {
242 - $lastUserData['groups'] = ApiQueryUsers::getAutoGroups( User::newFromName( $lastUser ) );
 243+ if ( !isset( $lastUserData['groups'] ) && $lastUserObj ) {
 244+ $lastUserData['groups'] = ApiQueryUsers::getAutoGroups( $lastUserObj );
243245 }
244246
245247 if ( !is_null( $row->ug_group2 ) ) {
@@ -247,13 +249,13 @@
248250 $result->setIndexedTagName( $lastUserData['groups'], 'g' );
249251 }
250252
251 - if ( $fld_implicitgroups && !isset( $lastUserData['implicitgroups'] ) ) {
252 - $lastUserData['implicitgroups'] = ApiQueryUsers::getAutoGroups( User::newFromName( $lastUser ) );
 253+ if ( $fld_implicitgroups && !isset( $lastUserData['implicitgroups'] ) && $lastUserObj ) {
 254+ $lastUserData['implicitgroups'] = ApiQueryUsers::getAutoGroups( $lastUserObj );
253255 $result->setIndexedTagName( $lastUserData['implicitgroups'], 'g' );
254256 }
255257 if ( $fld_rights ) {
256 - if ( !isset( $lastUserData['rights'] ) ) {
257 - $lastUserData['rights'] = User::getGroupPermissions( User::newFromName( $lastUser )->getAutomaticGroups() );
 258+ if ( !isset( $lastUserData['rights'] ) && $lastUserObj ) {
 259+ $lastUserData['rights'] = User::getGroupPermissions( $lastUserObj->getAutomaticGroups() );
258260 }
259261 if ( !is_null( $row->ug_group2 ) ) {
260262 $lastUserData['rights'] = array_unique( array_merge( $lastUserData['rights'],

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r99484list=allusers was throwing fatals when invalid user names occurred in the dat...catrope15:45, 11 October 2011

Status & tagging log