From a932d0c42954f1bc29efae6683fd198aeef70f08 Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Tue, 17 May 2016 09:35:10 -0400 Subject: [PATCH] API: Handle shorthand "all groups" configuration in ApiQuerySiteInfo In $wgAddGroups, $wgRemoveGroups, $wgGroupsAddToSelf, and $wgGroupsRemoveFromSelf, boolean true in place of an array of groups to allow adding/removing is shorthand for "all groups". Handle this appropriately in action=query&meta=siteinfo&siprop=usergroups. Bug: T135467 Change-Id: I6ae61ef14ac7932e3369155c56bad60a9d72060d --- includes/api/ApiQuerySiteinfo.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index a08740a43e..0774651c11 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -485,7 +485,7 @@ class ApiQuerySiteinfo extends ApiQueryBase { $data = []; $result = $this->getResult(); - $allGroups = User::getAllGroups(); + $allGroups = array_values( User::getAllGroups() ); foreach ( $config->get( 'GroupPermissions' ) as $group => $permissions ) { $arr = [ 'name' => $group, @@ -512,7 +512,11 @@ class ApiQuerySiteinfo extends ApiQueryBase { foreach ( $groupArr as $type => $rights ) { if ( isset( $rights[$group] ) ) { - $groups = array_intersect( $rights[$group], $allGroups ); + if ( $rights[$group] === true ) { + $groups = $allGroups; + } else { + $groups = array_intersect( $rights[$group], $allGroups ); + } if ( $groups ) { $arr[$type] = $groups; ApiResult::setArrayType( $arr[$type], 'BCarray' ); -- 2.20.1