API: Add $wgAPIFormatModules
authorBrad Jorsch <bjorsch@wikimedia.org>
Wed, 27 Nov 2013 16:40:17 +0000 (11:40 -0500)
committerBrad Jorsch <bjorsch@wikimedia.org>
Wed, 27 Nov 2013 16:40:17 +0000 (11:40 -0500)
The API currently allows for adding action modules with
$wgAPIModules and query modules with various other $wgAPI*Modules
variables. But there's no way to add a formatting module from an
extension. For parallelism, let's add $wgAPIFormatModules to do just
that.

Bug: 57637
Change-Id: Ia0bd253104a4b5bc56d4fe0dc6736e2129b126f3

includes/DefaultSettings.php
includes/api/ApiMain.php

index 951dc21..e23aea4 100644 (file)
@@ -6539,6 +6539,7 @@ $wgDebugAPI = false;
  * @todo Describe each of the variables, group them and add examples
  */
 $wgAPIModules = array();
+$wgAPIFormatModules = array();
 $wgAPIMetaModules = array();
 $wgAPIPropModules = array();
 $wgAPIListModules = array();
index a9aebe9..861fa82 100644 (file)
@@ -185,11 +185,12 @@ class ApiMain extends ApiBase {
                        }
                }
 
-               global $wgAPIModules;
+               global $wgAPIModules, $wgAPIFormatModules;
                $this->mModuleMgr = new ApiModuleManager( $this );
                $this->mModuleMgr->addModules( self::$Modules, 'action' );
                $this->mModuleMgr->addModules( $wgAPIModules, 'action' );
                $this->mModuleMgr->addModules( self::$Formats, 'format' );
+               $this->mModuleMgr->addModules( $wgAPIFormatModules, 'format' );
 
                $this->mResult = new ApiResult( $this );
                $this->mEnableWrite = $enableWrite;