Update on r44048:
authorNathaniel Herman <pinky@users.mediawiki.org>
Thu, 4 Dec 2008 01:39:01 +0000 (01:39 +0000)
committerNathaniel Herman <pinky@users.mediawiki.org>
Thu, 4 Dec 2008 01:39:01 +0000 (01:39 +0000)
Removing SpecialListusersGetGroups hook completely, and changing the
UsersPager::getGroups function to use User::getEffectiveGroups instead
of directly making a DB query itself.

RELEASE-NOTES
docs/hooks.txt
includes/specials/SpecialListusers.php

index 0e1acd1..f255074 100644 (file)
@@ -216,8 +216,6 @@ The following extensions are migrated into MediaWiki 1.14:
 * Moved password reset form from Special:Preferences to Special:ResetPass
 * Added Special:ChangePassword as a special page alias for Special:ResetPass
 * Added complimentary function for addHandler() called removeHandler() for removing events
-* Added hook SpecialListusersGetGroups which is called right before the end of UsersPager::getGroups()
-  and can be used by extensions to add to the user's groups.
 
 === Bug fixes in 1.14 ===
 
index 00c5f5a..9c3058e 100644 (file)
@@ -1206,10 +1206,6 @@ $query: The query array to be returned
 $item: HTML to be returned. Will be wrapped in <li></li> after the hook finishes
 $row: Database row object
 
-'SpecialListusersGetGroups': called right before the end of UsersPager::getGroups()
-&$groups: array of groups the user is in
-$uid: User identifier
-
 'SpecialListusersHeader': called before closing the <fieldset> in UsersPager::getPageHeader()
 $pager: The UsersPager instance
 $out: The header HTML
index 4328d55..17bec70 100644 (file)
@@ -215,15 +215,8 @@ class UsersPager extends AlphabeticPager {
         * @return array
         */
        protected static function getGroups( $uid ) {
-               $dbr = wfGetDB( DB_SLAVE );
-               $groups = array();
-               $res = $dbr->select( 'user_groups', 'ug_group', array( 'ug_user' => $uid ), __METHOD__ );
-               if( $res && $dbr->numRows( $res ) > 0 ) {
-                       while( $row = $dbr->fetchObject( $res ) )
-                               $groups[] = $row->ug_group;
-                       $dbr->freeResult( $res );
-               }
-               wfRunHooks( 'SpecialListusersGetGroups', array( &$groups, $uid ) );
+               $user = User::newFromId( $uid );
+               $groups = array_diff( $user->getEffectiveGroups(), $user->getImplicitGroups() );
                return $groups;
        }