Krinkle has uploaded a new change for review. https://gerrit.wikimedia.org/r/247475
Change subject: resourceloader: Remove 'loaderScripts' option from FileModule ...................................................................... resourceloader: Remove 'loaderScripts' option from FileModule Not used in any of our public repositories. Bug: T65240 Change-Id: I1e9f741c3ef0f922129ecd10039228b58565bf62 --- M includes/resourceloader/ResourceLoaderFileModule.php M includes/resourceloader/ResourceLoaderModule.php M includes/resourceloader/ResourceLoaderStartUpModule.php M tests/phpunit/structure/ResourcesTest.php 4 files changed, 5 insertions(+), 63 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/75/247475/1 diff --git a/includes/resourceloader/ResourceLoaderFileModule.php b/includes/resourceloader/ResourceLoaderFileModule.php index bc17821..162c1a2 100644 --- a/includes/resourceloader/ResourceLoaderFileModule.php +++ b/includes/resourceloader/ResourceLoaderFileModule.php @@ -1,6 +1,6 @@ <?php /** - * Resource loader module based on local JavaScript/CSS files. + * ResourceLoader module based on local JavaScript/CSS files. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -72,15 +72,6 @@ * @endcode */ 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 @@ -195,8 +186,6 @@ * ), * // 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 @@ // Lists of file paths case 'scripts': case 'debugScripts': - case 'loaderScripts': case 'styles': $this->{$member} = (array)$option; break; @@ -392,18 +380,6 @@ } /** - * 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. * * @param ResourceLoaderContext $context @@ -552,8 +528,7 @@ $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; @@ -593,7 +568,6 @@ // - position (only used by OutputPage) 'scripts', 'debugScripts', - 'loaderScripts', 'styles', 'languageScripts', 'skinScripts', diff --git a/includes/resourceloader/ResourceLoaderModule.php b/includes/resourceloader/ResourceLoaderModule.php index c50e8b2..2850965 100644 --- a/includes/resourceloader/ResourceLoaderModule.php +++ b/includes/resourceloader/ResourceLoaderModule.php @@ -1,6 +1,6 @@ <?php /** - * Abstraction for resource loader modules. + * Abstraction for ResourceLoader modules. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -316,23 +316,10 @@ } /** - * 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. diff --git a/includes/resourceloader/ResourceLoaderStartUpModule.php b/includes/resourceloader/ResourceLoaderStartUpModule.php index 4a672f2..e900200 100644 --- a/includes/resourceloader/ResourceLoaderStartUpModule.php +++ b/includes/resourceloader/ResourceLoaderStartUpModule.php @@ -1,6 +1,6 @@ <?php /** - * Module for resource loader initialization. + * Module for ResourceLoader initialization. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -163,13 +163,9 @@ * - 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 @@ 'dependencies' => $module->getDependencies( $context ), 'group' => $module->getGroup(), 'source' => $module->getSource(), - 'loader' => $module->getLoaderScript(), 'skip' => $skipFunction, ); } @@ -240,22 +235,9 @@ // 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, diff --git a/tests/phpunit/structure/ResourcesTest.php b/tests/phpunit/structure/ResourcesTest.php index ae0d325..3282665 100644 --- a/tests/phpunit/structure/ResourcesTest.php +++ b/tests/phpunit/structure/ResourcesTest.php @@ -232,7 +232,6 @@ 'lists' => array( 'scripts', 'debugScripts', - 'loaderScripts', 'styles', ), -- To view, visit https://gerrit.wikimedia.org/r/247475 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1e9f741c3ef0f922129ecd10039228b58565bf62 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Krinkle <krinklem...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits