r44597 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44596‎ | r44597 | r44598 >
Date:22:06, 14 December 2008
Author:demon
Status:ok
Tags:
Comment:
Support extension information in meta=siteinfo.
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
@@ -73,6 +73,9 @@
7474 case 'usergroups':
7575 $this->appendUserGroups( $p );
7676 break;
 77+ case 'extensions':
 78+ $this->appendExtensions( $p );
 79+ break;
7780 default :
7881 ApiBase :: dieDebug( __METHOD__, "Unknown prop=$p" );
7982 }
@@ -183,7 +186,6 @@
184187 $this->getResult()->setIndexedTagName($data, 'magicword');
185188 $this->getResult()->addValue('query', $property, $data);
186189 }
187 -
188190
189191 protected function appendInterwikiMap( $property, $filter ) {
190192 $this->resetQueryParams();
@@ -278,6 +280,40 @@
279281 $this->getResult()->addValue( 'query', $property, $data );
280282 }
281283
 284+ protected function appendExtensions( $property ) {
 285+ global $wgExtensionCredits;
 286+ $data = array();
 287+ foreach ( $wgExtensionCredits as $type => $extensions ) {
 288+ foreach ( $extensions as $ext ) {
 289+ $ret = array();
 290+ $ret['type'] = $type;
 291+ if ( isset( $ext['name'] ) )
 292+ $ret['name'] = $ext['name'];
 293+ if ( isset( $ext['description'] ) )
 294+ $ret['description'] = $ext['description'];
 295+ if ( isset( $ext['descriptionmsg'] ) )
 296+ $ret['descriptionmsg'] = $ext['descriptionmsg'];
 297+ if ( isset( $ext['author'] ) ) {
 298+ $ret['author'] = is_array( $ext['author'] ) ?
 299+ implode( ', ', $ext['author' ] ) : $ext['author'];
 300+ }
 301+ if ( isset( $ext['version'] ) ) {
 302+ $ret['version'] = $ext['version'];
 303+ } elseif ( isset( $ext['svn-revision'] ) &&
 304+ preg_match( '/\$(?:Rev|LastChangedRevision|Revision): *(\d+)/',
 305+ $ext['svn-revision'], $m ) )
 306+ {
 307+ $ret['version'] = 'r' . $m[1];
 308+ }
 309+ $data[] = $ret;
 310+ }
 311+ }
 312+
 313+ $this->getResult()->setIndexedTagName( $data, 'ext' );
 314+ $this->getResult()->addValue( 'query', $property, $data );
 315+ }
 316+
 317+
282318 public function getAllowedParams() {
283319 return array(
284320 'prop' => array(
@@ -293,6 +329,7 @@
294330 'dbrepllag',
295331 'statistics',
296332 'usergroups',
 333+ 'extensions',
297334 )
298335 ),
299336 'filteriw' => array(
@@ -318,6 +355,7 @@
319356 ' "interwikimap" - Returns interwiki map (optionally filtered)',
320357 ' "dbrepllag" - Returns database server with the highest replication lag',
321358 ' "usergroups" - Returns user groups and the associated permissions',
 359+ ' "extensions" - Returns extensions installed on the wiki',
322360 ),
323361 'filteriw' => 'Return only local or only nonlocal entries of the interwiki map',
324362 'showalldb' => 'List all database servers, not just the one lagging the most',
Index: trunk/phase3/RELEASE-NOTES
@@ -520,6 +520,7 @@
521521 * (bug 15579) clshow considers all categories !hidden
522522 * (bug 16647) list=allcategories, prop=categories don't return "hidden"
523523 property for hidden categories
 524+* New siprop parameter of 'extensions' to list all installed extensions
524525
525526 === Languages updated in 1.14 ===
526527

Status & tagging log