r70587 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70586‎ | r70587 | r70588 >
Date:19:25, 6 August 2010
Author:soxred93
Status:resolved (Comments)
Tags:
Comment:
* (bug 24236) Add add, remove, add-self, remove-self tags to meta=siteinfo&siprop=usergroups
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
@@ -322,7 +322,8 @@
323323 }
324324
325325 protected function appendUserGroups( $property, $numberInGroup ) {
326 - global $wgGroupPermissions;
 326+ global $wgGroupPermissions, $wgAddGroups, $wgRemoveGroups, $wgGroupsAddToSelf, $wgGroupsRemoveFromSelf;
 327+
327328 $data = array();
328329 foreach ( $wgGroupPermissions as $group => $permissions ) {
329330 $arr = array(
@@ -332,11 +333,25 @@
333334 if ( $numberInGroup ) {
334335 $arr['number'] = SiteStats::numberInGroup( $group );
335336 }
336 -
 337+
 338+ $groupArr = array(
 339+ 'add' => &$wgAddGroups,
 340+ 'remove' => &$wgRemoveGroups,
 341+ 'add-self' => &$wgGroupsAddToSelf,
 342+ 'remove-self' => &$wgGroupsRemoveFromSelf
 343+ );
 344+
 345+ foreach( $groupArr as $type => $rights ) {
 346+ if( isset( $rights[$group] ) ) {
 347+ $arr[$type] = $rights[$group];
 348+ $this->getResult()->setIndexedTagName( $arr[$type], 'group' );
 349+ }
 350+ }
 351+
337352 $this->getResult()->setIndexedTagName( $arr['rights'], 'permission' );
338353 $data[] = $arr;
339354 }
340 -
 355+
341356 $this->getResult()->setIndexedTagName( $data, 'group' );
342357 return $this->getResult()->addValue( 'query', $property, $data );
343358 }
Index: trunk/phase3/RELEASE-NOTES
@@ -330,6 +330,7 @@
331331 the timestamp of the last edit
332332 * (bug 24677) axto= parameters added to allcategories, allimages, alllinks, allmessages,
333333 allpages, and allusers
 334+* (bug 24236) Add add, remove, add-self, remove-self tags to meta=siteinfo&siprop=usergroups
334335
335336 === Languages updated in 1.17 ===
336337

Follow-up revisions

RevisionCommit summaryAuthorDate
r70634Followup r70587: Remove unnecessary referencessoxred9316:46, 7 August 2010

Comments

#Comment by Catrope (talk | contribs)   14:45, 7 August 2010
+			$groupArr = array(
+				'add' => &$wgAddGroups,
+				'remove' => &$wgRemoveGroups,
+				'add-self' => &$wgGroupsAddToSelf,
+				'remove-self' => &$wgGroupsRemoveFromSelf
+			);

Why would you use references here? This seems to lead to setIndexedTagName() operating on the original globals, which is asking for trouble.

Status & tagging log