From efe384a900eb372f533380e31cc5e67bd394ab74 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Fri, 31 Aug 2007 15:23:48 +0000 Subject: [PATCH] Allow API modules to be defined in extensions --- includes/DefaultSettings.php | 7 +++++++ includes/api/ApiMain.php | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index e45f8dd80a..812b75fe81 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -2699,6 +2699,13 @@ $wgEnableAPI = true; */ $wgEnableWriteAPI = false; +/** + * API module extensions + * Associative array mapping module name to class name. + * Extension modules may override the core modules. + */ +$wgAPIModules = array(); + /** * Parser test suite files to be run by parserTests.php when no specific * filename is passed to it. diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index b33e762119..87e77666f2 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -106,7 +106,9 @@ class ApiMain extends ApiBase { } } - $this->mModules = self :: $Modules; + global $wgAPIModules; // extension modules + $this->mModules = $wgAPIModules + self :: $Modules; + $this->mModuleNames = array_keys($this->mModules); // todo: optimize $this->mFormats = self :: $Formats; $this->mFormatNames = array_keys($this->mFormats); // todo: optimize -- 2.20.1