resourceloader: Remove 'loaderScripts' option from FileModule
authorTimo Tijhof <krinklemail@gmail.com>
Mon, 19 Oct 2015 23:04:23 +0000 (00:04 +0100)
committerTimo Tijhof <krinklemail@gmail.com>
Wed, 28 Oct 2015 02:53:16 +0000 (02:53 +0000)
Not used in any of our public repositories.

Bug: T65240
Change-Id: I1e9f741c3ef0f922129ecd10039228b58565bf62

RELEASE-NOTES-1.27
includes/resourceloader/ResourceLoaderFileModule.php
includes/resourceloader/ResourceLoaderModule.php
includes/resourceloader/ResourceLoaderStartUpModule.php
tests/phpunit/structure/ResourcesTest.php

index b3add69..3a45fae 100644 (file)
@@ -92,6 +92,7 @@ changes to languages because of Bugzilla reports.
 * ProfilerOutputUdp was removed. Note that there is a ProfilerOutputStats class.
 * WikiPage::doDeleteArticleReal() and WikiPage::doDeleteArticle() now
   ignore the 2nd and 3rd arguments (formerly $id and $commit).
+* Removed "loaderScripts" option from ResourceLoaderFileModule class.
 
 == Compatibility ==
 
index e4def4d..b46707c 100644 (file)
@@ -73,15 +73,6 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
         */
        protected $debugScripts = array();
 
-       /**
-        * @var array List of paths to JavaScript files to include in the startup module
-        * @par Usage:
-        * @code
-        * array( [file-path], [file-path], ... )
-        * @endcode
-        */
-       protected $loaderScripts = array();
-
        /**
         * @var array List of paths to CSS files to always include
         * @par Usage:
@@ -195,8 +186,6 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
         *         ),
         *         // Scripts to include in debug contexts
         *         'debugScripts' => [file path string or array of file path strings],
-        *         // Scripts to include in the startup module
-        *         'loaderScripts' => [file path string or array of file path strings],
         *         // Modules which must be loaded before this module
         *         'dependencies' => [module name string or array of module name strings],
         *         'templates' => array(
@@ -239,7 +228,6 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
                                // Lists of file paths
                                case 'scripts':
                                case 'debugScripts':
-                               case 'loaderScripts':
                                case 'styles':
                                        $this->{$member} = (array)$option;
                                        break;
@@ -390,18 +378,6 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
                return $this->debugRaw;
        }
 
-       /**
-        * Get loader script.
-        *
-        * @return string|bool JavaScript code to be added to startup module
-        */
-       public function getLoaderScript() {
-               if ( count( $this->loaderScripts ) === 0 ) {
-                       return false;
-               }
-               return $this->readScriptFiles( $this->loaderScripts );
-       }
-
        /**
         * Get all styles for a given context.
         *
@@ -551,8 +527,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
                        $this->templates,
                        $context->getDebug() ? $this->debugScripts : array(),
                        $this->getLanguageScripts( $context->getLanguage() ),
-                       self::tryForKey( $this->skinScripts, $context->getSkin(), 'default' ),
-                       $this->loaderScripts
+                       self::tryForKey( $this->skinScripts, $context->getSkin(), 'default' )
                );
                if ( $this->skipFunction ) {
                        $files[] = $this->skipFunction;
@@ -592,7 +567,6 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
                        // - position (only used by OutputPage)
                        'scripts',
                        'debugScripts',
-                       'loaderScripts',
                        'styles',
                        'languageScripts',
                        'skinScripts',
index 3dd7a4b..782af81 100644 (file)
@@ -298,25 +298,12 @@ abstract class ResourceLoaderModule {
                return false;
        }
 
-       /**
-        * Get the loader JS for this module, if set.
-        *
-        * @return mixed JavaScript loader code as a string or boolean false if no custom loader set
-        */
-       public function getLoaderScript() {
-               // Stub, override expected
-               return false;
-       }
-
        /**
         * Get a list of modules this module depends on.
         *
         * Dependency information is taken into account when loading a module
         * on the client side.
         *
-        * To add dependencies dynamically on the client side, use a custom
-        * loader script, see getLoaderScript()
-        *
         * Note: It is expected that $context will be made non-optional in the near
         * future.
         *
index 4a672f2..8a2423c 100644 (file)
@@ -163,13 +163,9 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
         *  - array 'dependencies'
         *  - string|null 'group'
         *  - string 'source'
-        *  - string|false 'loader'
         */
        public static function compileUnresolvedDependencies( array &$registryData ) {
                foreach ( $registryData as $name => &$data ) {
-                       if ( $data['loader'] !== false ) {
-                               continue;
-                       }
                        $dependencies = $data['dependencies'];
                        foreach ( $data['dependencies'] as $dependency ) {
                                $implicitDependencies = self::getImplicitDependencies( $registryData, $dependency );
@@ -230,7 +226,6 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
                                'dependencies' => $module->getDependencies( $context ),
                                'group' => $module->getGroup(),
                                'source' => $module->getSource(),
-                               'loader' => $module->getLoaderScript(),
                                'skip' => $skipFunction,
                        );
                }
@@ -240,22 +235,9 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
                // Register sources
                $out .= ResourceLoader::makeLoaderSourcesScript( $resourceLoader->getSources() );
 
-               // Concatenate module loader scripts and figure out the different call
-               // signatures for mw.loader.register
+               // Figure out the different call signatures for mw.loader.register
                $registrations = array();
                foreach ( $registryData as $name => $data ) {
-                       if ( $data['loader'] !== false ) {
-                               $out .= ResourceLoader::makeCustomLoaderScript(
-                                       $name,
-                                       $data['version'],
-                                       $data['dependencies'],
-                                       $data['group'],
-                                       $data['source'],
-                                       $data['loader']
-                               );
-                               continue;
-                       }
-
                        // Call mw.loader.register(name, version, dependencies, group, source, skip)
                        $registrations[] = array(
                                $name,
index ae0d325..3282665 100644 (file)
@@ -232,7 +232,6 @@ class ResourcesTest extends MediaWikiTestCase {
                        'lists' => array(
                                'scripts',
                                'debugScripts',
-                               'loaderScripts',
                                'styles',
                        ),