http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97307

Revision: 97307
Author:   reedy
Date:     2011-09-16 18:25:02 +0000 (Fri, 16 Sep 2011)
Log Message:
-----------
Add handling of format modules to ApiParamInfo

Modified Paths:
--------------
    trunk/phase3/includes/api/ApiParamInfo.php

Modified: trunk/phase3/includes/api/ApiParamInfo.php
===================================================================
--- trunk/phase3/includes/api/ApiParamInfo.php  2011-09-16 18:19:27 UTC (rev 
97306)
+++ trunk/phase3/includes/api/ApiParamInfo.php  2011-09-16 18:25:02 UTC (rev 
97307)
@@ -88,6 +88,21 @@
                        $pageSet = new ApiPageSet( $this->queryObj );
                        $r['pagesetmodule'] = $this->getClassInfo( $pageSet );
                }
+               if ( is_array( $params['formatmodules'] ) ) {
+                       $formats = $this->getMain()->getFormats();
+                       $r['formatmodules'] = array();
+                       foreach ( $params['formatmodules'] as $f ) {
+                               if ( !isset( $formats[$f] ) ) {
+                                       $r['formatmodules'][] = array( 'name' 
=> $f, 'missing' => '' );
+                                       continue;
+                               }
+                               $obj = new $formats[$f]( $this, $f );
+                               $a = $this->getClassInfo( $obj );
+                               $a['name'] = $f;
+                               $r['formatmodules'][] = $a;
+                       }
+                       $result->setIndexedTagName( $r['formatmodules'], 
'module' );
+               }
                $result->addValue( null, $this->getModuleName(), $r );
        }
 
@@ -237,6 +252,10 @@
                        ),
                        'mainmodule' => false,
                        'pagesetmodule' => false,
+                       'formatmodules' => array(
+                               ApiBase::PARAM_ISMULTI => true,
+                               ApiBase::PARAM_TYPE => array_keys( 
$this->getMain()->getFormats() ),
+                       )
                );
        }
 
@@ -246,6 +265,7 @@
                        'querymodules' => 'List of query module names (value of 
prop=, meta= or list= parameter)',
                        'mainmodule' => 'Get information about the main 
(top-level) module as well',
                        'pagesetmodule' => 'Get information about the pageset 
module (providing titles= and friends) as well',
+                       'formatmodules' => 'List of format module names (value 
of format= parameter)',
                );
        }
 


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to