From: Bryan Tong Minh Date: Sun, 12 Jul 2009 12:10:27 +0000 (+0000) Subject: (bug 17809) Add number of users in user groups to meta=siteinfo X-Git-Tag: 1.31.0-rc.0~40996 X-Git-Url: http://git.cyclocoop.org/%22.%24image2.%22?a=commitdiff_plain;h=b17adbc88079b8bd4129a0b365a3a38e08fb09e3;p=lhc%2Fweb%2Fwiklou.git (bug 17809) Add number of users in user groups to meta=siteinfo --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 18805ddfe2..5ec592fd79 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -285,6 +285,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 19423) The initial file description page used caption in user lang rather than UI lang * Added snippet field to list=search output +* (bug 17809) Add number of users in user groups to meta=siteinfo === Languages updated in 1.16 === diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index c4c86b75bf..8b84b70172 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -72,7 +72,7 @@ class ApiQuerySiteinfo extends ApiQueryBase { $fit = $this->appendStatistics( $p ); break; case 'usergroups': - $fit = $this->appendUserGroups( $p ); + $fit = $this->appendUserGroups( $p, $params['numberingroup'] ); break; case 'extensions': $fit = $this->appendExtensions( $p ); @@ -316,11 +316,17 @@ class ApiQuerySiteinfo extends ApiQueryBase { return $this->getResult()->addValue( 'query', $property, $data ); } - protected function appendUserGroups( $property ) { + protected function appendUserGroups( $property, $numberInGroup ) { global $wgGroupPermissions; $data = array(); foreach( $wgGroupPermissions as $group => $permissions ) { - $arr = array( 'name' => $group, 'rights' => array_keys( $permissions, true ) ); + $arr = array( + 'name' => $group, + 'rights' => array_keys( $permissions, true ), + ); + if ( $numberInGroup ) + $arr['number'] = SiteStats::numberInGroup( $group ); + $this->getResult()->setIndexedTagName( $arr['rights'], 'permission' ); $data[] = $arr; } @@ -431,6 +437,7 @@ class ApiQuerySiteinfo extends ApiQueryBase { ) ), 'showalldb' => false, + 'numberingroup' => false, ); } @@ -454,6 +461,7 @@ class ApiQuerySiteinfo extends ApiQueryBase { ), 'filteriw' => 'Return only local or only nonlocal entries of the interwiki map', 'showalldb' => 'List all database servers, not just the one lagging the most', + 'numberingroup' => 'Lists the number of users in user groups', ); }