r32740 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r32739‎ | r32740 | r32741 >
Date:14:33, 3 April 2008
Author:catrope
Status:old
Tags:
Comment:
(bug 13603) Added siprop=usergroups to meta=siteinfo. Patch by Mormegil
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiQuerySiteinfo.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQuerySiteinfo.php
@@ -69,6 +69,9 @@
7070 case 'statistics' :
7171 $this->appendStatistics($p);
7272 break;
 73+ case 'usergroups' :
 74+ $this->appendUserGroups($p);
 75+ break;
7376 }
7477 }
7578 }
@@ -224,7 +227,21 @@
225228 $data['jobs'] = intval(SiteStats::jobs());
226229 $this->getResult()->addValue('query', $property, $data);
227230 }
228 -
 231+
 232+ protected function appendUserGroups($property) {
 233+ global $wgGroupPermissions;
 234+
 235+ $data = array ();
 236+ foreach ($wgGroupPermissions as $group => $permissions) {
 237+ $arr = array ('name' => $group, 'rights' => array_keys($permissions, true));
 238+ $this->getResult()->setIndexedTagName($arr['rights'], 'permission');
 239+ $data[] = $arr;
 240+ }
 241+
 242+ $this->getResult()->setIndexedTagName($data, 'group');
 243+ $this->getResult()->addValue('query', $property, $data);
 244+ }
 245+
229246 public function getAllowedParams() {
230247 return array (
231248
@@ -239,6 +256,7 @@
240257 'interwikimap',
241258 'dbrepllag',
242259 'statistics',
 260+ 'usergroups',
243261 )),
244262
245263 'filteriw' => array (
@@ -262,6 +280,7 @@
263281 ' "statistics" - Returns site statistics',
264282 ' "interwikimap" - Returns interwiki map (optionally filtered)',
265283 ' "dbrepllag" - Returns database server with the highest replication lag',
 284+ ' "usergroups" - Returns user groups and the associated permissions',
266285 ),
267286 'filteriw' => 'Return only local or only nonlocal entries of the interwiki map',
268287 'showalldb' => 'List all database servers, not just the one lagging the most',
Index: trunk/phase3/RELEASE-NOTES
@@ -186,6 +186,7 @@
187187 * (bug 13541) Added siprop=specialpagealiases to meta=siteinfo
188188 * Added fallback8bitEncoding field to meta=siteinfo&siprop=general output
189189 * (bug 13544) Added prop=revid to action=parse
 190+* (bug 13603) Added siprop=usergroups to meta=siteinfo
190191
191192 === Languages updated in 1.13 ===
192193

Follow-up revisions

RevisionCommit summaryAuthorDate
r33067* (bug 13604) Add Special:ListGroupRights to show a list of defined usergroup...raymond10:10, 10 April 2008

Status & tagging log