Merge "Add new UsersPagerDoBatchLookups hook to allow for extensions to modify UsersP...
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 27 Aug 2016 22:05:43 +0000 (22:05 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 27 Aug 2016 22:05:43 +0000 (22:05 +0000)
docs/hooks.txt
includes/specials/pagers/UsersPager.php

index 7f1640b..1e3cf1e 100644 (file)
@@ -3650,6 +3650,16 @@ $userId: User id of the current user
 $userText: User name of the current user
 &$items: Array of user tool links as HTML fragments
 
+'UsersPagerDoBatchLookups': Called in UsersPager::doBatchLookups() to give
+extensions providing user group data from an alternate source a chance to add
+their data into the cache array so that things like global user groups are
+displayed correctly in Special:ListUsers.
+$dbr: Read-only database handle
+$userIds: Array of user IDs whose groups we should look up
+&$cache: Array of user ID -> internal user group name (e.g. 'sysop') mappings
+&$groups: Array of group name -> bool true mappings for members of a given user
+group
+
 'ValidateExtendedMetadataCache': Called to validate the cached metadata in
 FormatMetadata::getExtendedMeta (return false means cache will be
 invalidated and GetExtendedMetadata hook called again).
index 7b058c1..adc1dd8 100644 (file)
@@ -241,6 +241,11 @@ class UsersPager extends AlphabeticPager {
                        $cache[intval( $row->ug_user )][] = $row->ug_group;
                        $groups[$row->ug_group] = true;
                }
+
+               // Give extensions a chance to add things like global user group data
+               // into the cache array to ensure proper output later on
+               Hooks::run( 'UsersPagerDoBatchLookups', [ $dbr, $userIds, &$cache, &$groups ] );
+
                $this->userGroupCache = $cache;
 
                // Add page of groups to link batch