From 8802bc8ec341463a8558020a6565ff42878ab6a2 Mon Sep 17 00:00:00 2001 From: Nathaniel Herman Date: Thu, 4 Dec 2008 01:39:01 +0000 Subject: [PATCH] Update on r44048: Removing SpecialListusersGetGroups hook completely, and changing the UsersPager::getGroups function to use User::getEffectiveGroups instead of directly making a DB query itself. --- RELEASE-NOTES | 2 -- docs/hooks.txt | 4 ---- includes/specials/SpecialListusers.php | 11 ++--------- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 0e1acd15c5..f255074979 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/docs/hooks.txt b/docs/hooks.txt index 00c5f5a2aa..9c3058e8c6 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -1206,10 +1206,6 @@ $query: The query array to be returned $item: HTML to be returned. Will be wrapped in
  • 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
    in UsersPager::getPageHeader() $pager: The UsersPager instance $out: The header HTML diff --git a/includes/specials/SpecialListusers.php b/includes/specials/SpecialListusers.php index 4328d55091..17bec70e07 100644 --- a/includes/specials/SpecialListusers.php +++ b/includes/specials/SpecialListusers.php @@ -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; } -- 2.20.1