From 18aab5e39503837c858f7d38992d067b644983a4 Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Tue, 10 Feb 2015 16:43:12 -0800 Subject: [PATCH] registration: Apply ResourceFileModulePaths to all modules Previously any module definition that specified a "class" was skipped. This is problematic for custom modules that extend ResourceLoaderFileModule and should be using the default paths. Since we can't determine at initialization time whether a module class is a ResourceLoaderFileModule or not, just add the default paths to all modules, and leave it up to the individual classes to use the extra arguments or not. Change-Id: Iee5d178343326030968755983f62629b81ef3c88 --- includes/registration/ExtensionProcessor.php | 2 +- tests/phpunit/includes/registration/ExtensionProcessorTest.php | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/includes/registration/ExtensionProcessor.php b/includes/registration/ExtensionProcessor.php index bf42aba932..a2dcd59da1 100644 --- a/includes/registration/ExtensionProcessor.php +++ b/includes/registration/ExtensionProcessor.php @@ -197,7 +197,7 @@ class ExtensionProcessor implements Processor { if ( isset( $data['localBasePath'] ) ) { $data['localBasePath'] = "$dir/{$data['localBasePath']}"; } - if ( $defaultPaths && !isset( $data['class'] ) ) { + if ( $defaultPaths ) { $data += $defaultPaths; } $this->globals['wgResourceModules'][$name] = $data; diff --git a/tests/phpunit/includes/registration/ExtensionProcessorTest.php b/tests/phpunit/includes/registration/ExtensionProcessorTest.php index d2254df2c8..b4c225c802 100644 --- a/tests/phpunit/includes/registration/ExtensionProcessorTest.php +++ b/tests/phpunit/includes/registration/ExtensionProcessorTest.php @@ -249,11 +249,14 @@ class ExtensionProcessorTest extends MediaWikiTestCase { 'test.class' => array( 'class' => 'FooBarModule', 'extra' => 'argument', + 'localBasePath' => $dir, + 'remoteExtPath' => 'FooBar', ), 'test.class.with.path' => array( 'class' => 'FooBarPathModule', 'extra' => 'argument', 'localBasePath' => $dir, + 'remoteExtPath' => 'FooBar', ) ), ), -- 2.20.1