From 64692bfd3649fa882d6284d79da7fe6135a97dbf Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Thu, 25 Aug 2016 23:00:28 -0700 Subject: [PATCH] registration: Support 'ServiceWiringFiles' in extension.json Change-Id: Ib413a14cb8e21207264fa1c45d84550b3eab7a4e --- docs/extension.schema.json | 4 ++++ docs/extension.schema.v1.json | 4 ++++ includes/registration/ExtensionProcessor.php | 10 ++++++++++ 3 files changed, 18 insertions(+) diff --git a/docs/extension.schema.json b/docs/extension.schema.json index c01001421d..384bfb4b10 100644 --- a/docs/extension.schema.json +++ b/docs/extension.schema.json @@ -908,6 +908,10 @@ "type": "array", "description": "Parser test suite files to be run by parserTests.php when no specific filename is passed to it" }, + "ServiceWiringFiles": { + "type": "array", + "description": "List of service wiring files to be loaded by the default instance of MediaWikiServices" + }, "load_composer_autoloader": { "type": "boolean", "description": "Load the composer autoloader for this extension, if one is present" diff --git a/docs/extension.schema.v1.json b/docs/extension.schema.v1.json index d7078648aa..c4a1a8dbd0 100644 --- a/docs/extension.schema.v1.json +++ b/docs/extension.schema.v1.json @@ -887,6 +887,10 @@ "type": "array", "description": "Parser test suite files to be run by parserTests.php when no specific filename is passed to it" }, + "ServiceWiringFiles": { + "type": "array", + "description": "List of service wiring files to be loaded by the default instance of MediaWikiServices" + }, "load_composer_autoloader": { "type": "boolean", "description": "Load the composer autoloader for this extension, if one is present" diff --git a/includes/registration/ExtensionProcessor.php b/includes/registration/ExtensionProcessor.php index 5555e8b2bc..745c233b51 100644 --- a/includes/registration/ExtensionProcessor.php +++ b/includes/registration/ExtensionProcessor.php @@ -110,6 +110,7 @@ class ExtensionProcessor implements Processor { 'type', 'config', 'config_prefix', + 'ServiceWiringFiles', 'ParserTestFiles', 'AutoloadClasses', 'manifest_version', @@ -174,6 +175,7 @@ class ExtensionProcessor implements Processor { $this->extractMessagesDirs( $dir, $info ); $this->extractNamespaces( $info ); $this->extractResourceLoaderModules( $dir, $info ); + $this->extractServiceWiringFiles( $dir, $info ); $this->extractParserTestFiles( $dir, $info ); if ( isset( $info['callback'] ) ) { $this->callbacks[] = $info['callback']; @@ -406,6 +408,14 @@ class ExtensionProcessor implements Processor { } } + protected function extractServiceWiringFiles( $dir, array $info ) { + if ( isset( $info['ServiceWiringFiles'] ) ) { + foreach ( $info['ServiceWiringFiles'] as $path ) { + $this->globals['wgServiceWiringFiles'][] = "$dir/$path"; + } + } + } + protected function extractParserTestFiles( $dir, array $info ) { if ( isset( $info['ParserTestFiles'] ) ) { foreach ( $info['ParserTestFiles'] as $path ) { -- 2.20.1