registration: Apply ResourceFileModulePaths to all modules
authorKunal Mehta <legoktm@gmail.com>
Wed, 11 Feb 2015 00:43:12 +0000 (16:43 -0800)
committerCatrope <roan.kattouw@gmail.com>
Wed, 11 Feb 2015 01:46:11 +0000 (01:46 +0000)
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
tests/phpunit/includes/registration/ExtensionProcessorTest.php

index bf42aba..a2dcd59 100644 (file)
@@ -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;
index d2254df..b4c225c 100644 (file)
@@ -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',
                                                )
                                        ),
                                ),