From: Kunal Mehta Date: Wed, 11 Feb 2015 00:43:12 +0000 (-0800) Subject: registration: Apply ResourceFileModulePaths to all modules X-Git-Tag: 1.31.0-rc.0~12455^2 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=18aab5e39503837c858f7d38992d067b644983a4;p=lhc%2Fweb%2Fwiklou.git 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 --- 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', ) ), ),