r97307 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97306‎ | r97307 | r97308 >
Date:18:25, 16 September 2011
Author:reedy
Status:ok
Tags:
Comment:
Add handling of format modules to ApiParamInfo
Modified paths:
  • /trunk/phase3/includes/api/ApiParamInfo.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiParamInfo.php
@@ -88,6 +88,21 @@
8989 $pageSet = new ApiPageSet( $this->queryObj );
9090 $r['pagesetmodule'] = $this->getClassInfo( $pageSet );
9191 }
 92+ if ( is_array( $params['formatmodules'] ) ) {
 93+ $formats = $this->getMain()->getFormats();
 94+ $r['formatmodules'] = array();
 95+ foreach ( $params['formatmodules'] as $f ) {
 96+ if ( !isset( $formats[$f] ) ) {
 97+ $r['formatmodules'][] = array( 'name' => $f, 'missing' => '' );
 98+ continue;
 99+ }
 100+ $obj = new $formats[$f]( $this, $f );
 101+ $a = $this->getClassInfo( $obj );
 102+ $a['name'] = $f;
 103+ $r['formatmodules'][] = $a;
 104+ }
 105+ $result->setIndexedTagName( $r['formatmodules'], 'module' );
 106+ }
92107 $result->addValue( null, $this->getModuleName(), $r );
93108 }
94109
@@ -237,6 +252,10 @@
238253 ),
239254 'mainmodule' => false,
240255 'pagesetmodule' => false,
 256+ 'formatmodules' => array(
 257+ ApiBase::PARAM_ISMULTI => true,
 258+ ApiBase::PARAM_TYPE => array_keys( $this->getMain()->getFormats() ),
 259+ )
241260 );
242261 }
243262
@@ -246,6 +265,7 @@
247266 'querymodules' => 'List of query module names (value of prop=, meta= or list= parameter)',
248267 'mainmodule' => 'Get information about the main (top-level) module as well',
249268 'pagesetmodule' => 'Get information about the pageset module (providing titles= and friends) as well',
 269+ 'formatmodules' => 'List of format module names (value of format= parameter)',
250270 );
251271 }
252272

Status & tagging log