From 3cc7e481f41640bf76c8e5e9f1ccb61b2412df3c Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Thu, 3 Apr 2008 14:33:36 +0000 Subject: [PATCH] (bug 13603) Added siprop=usergroups to meta=siteinfo. Patch by Mormegil --- RELEASE-NOTES | 1 + includes/api/ApiQuerySiteinfo.php | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 31d14b65a3..afa87786bb 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -186,6 +186,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 13541) Added siprop=specialpagealiases to meta=siteinfo * Added fallback8bitEncoding field to meta=siteinfo&siprop=general output * (bug 13544) Added prop=revid to action=parse +* (bug 13603) Added siprop=usergroups to meta=siteinfo === Languages updated in 1.13 === diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index c79e2fae92..b0ea015f86 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -69,6 +69,9 @@ class ApiQuerySiteinfo extends ApiQueryBase { case 'statistics' : $this->appendStatistics($p); break; + case 'usergroups' : + $this->appendUserGroups($p); + break; } } } @@ -224,7 +227,21 @@ class ApiQuerySiteinfo extends ApiQueryBase { $data['jobs'] = intval(SiteStats::jobs()); $this->getResult()->addValue('query', $property, $data); } - + + protected function appendUserGroups($property) { + global $wgGroupPermissions; + + $data = array (); + foreach ($wgGroupPermissions as $group => $permissions) { + $arr = array ('name' => $group, 'rights' => array_keys($permissions, true)); + $this->getResult()->setIndexedTagName($arr['rights'], 'permission'); + $data[] = $arr; + } + + $this->getResult()->setIndexedTagName($data, 'group'); + $this->getResult()->addValue('query', $property, $data); + } + public function getAllowedParams() { return array ( @@ -239,6 +256,7 @@ class ApiQuerySiteinfo extends ApiQueryBase { 'interwikimap', 'dbrepllag', 'statistics', + 'usergroups', )), 'filteriw' => array ( @@ -262,6 +280,7 @@ class ApiQuerySiteinfo extends ApiQueryBase { ' "statistics" - Returns site statistics', ' "interwikimap" - Returns interwiki map (optionally filtered)', ' "dbrepllag" - Returns database server with the highest replication lag', + ' "usergroups" - Returns user groups and the associated permissions', ), 'filteriw' => 'Return only local or only nonlocal entries of the interwiki map', 'showalldb' => 'List all database servers, not just the one lagging the most', -- 2.20.1