From: Brad Jorsch Date: Tue, 17 May 2016 13:35:10 +0000 (-0400) Subject: API: Handle shorthand "all groups" configuration in ApiQuerySiteInfo X-Git-Tag: 1.31.0-rc.0~6903 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22auteur_infos%22%2C%20%22id_auteur=%24id%22%29%20.%20%22?a=commitdiff_plain;h=a932d0c42954f1bc29efae6683fd198aeef70f08;p=lhc%2Fweb%2Fwiklou.git 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 --- 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' );