From: Timo Tijhof Date: Sat, 19 May 2018 18:37:21 +0000 (+0200) Subject: Remove deprecated wgResourceLoaderLESSImportPaths X-Git-Tag: 1.34.0-rc.0~5266^2 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=eaf40e6dd56ce415de57e28b0a97b77baf0d5fe8;p=lhc%2Fweb%2Fwiklou.git Remove deprecated wgResourceLoaderLESSImportPaths The last remaining users of this feature were MobileFrontend and Minerva, which have been migrated to direct imports. Bug: T140807 Change-Id: I1a66a2ad314bde332297798520e5ec3e0e3d4c9b --- diff --git a/RELEASE-NOTES-1.32 b/RELEASE-NOTES-1.32 index bef365393f..9ce8de933b 100644 --- a/RELEASE-NOTES-1.32 +++ b/RELEASE-NOTES-1.32 @@ -123,6 +123,9 @@ because of Phabricator reports. The UtfNormal\Utils class from the utfnormal library should be used instead. * The deprecated UTF8_ and UNICODE_ constants were removed. The class constants from the UtfNormal\Constants class from the utfnormal library should be used +* (T140807) The wgResourceLoaderLESSImportPaths configuration option was removed + from ResourceLoader. Instead, use `@import` statements in LESS to import + files directly from nearby directories within the same project. === Deprecations in 1.32 === * Use of a StartProfiler.php file is deprecated in favour of placing diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 1f55d327f3..562d887e17 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -3778,23 +3778,6 @@ $wgResourceLoaderLESSVars = [ 'deviceWidthTablet' => '720px', ]; -/** - * Default import paths for LESS modules. LESS files referenced in @import - * statements will be looked up here first, and relative to the importing file - * second. To avoid collisions, it's important for the LESS files in these - * directories to have a common, predictable file name prefix. - * - * Extensions need not (and should not) register paths in - * $wgResourceLoaderLESSImportPaths. The import path includes the path of the - * currently compiling LESS file, which allows each extension to freely import - * files from its own tree. - * - * @since 1.22 - */ -$wgResourceLoaderLESSImportPaths = [ - "$IP/resources/src/mediawiki.less/", -]; - /** * Whether ResourceLoader should attempt to persist modules in localStorage on * browsers that support the Web Storage API. diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index 1b8a4a8648..f3b6a70c6d 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -1711,6 +1711,7 @@ MESSAGE; * @return Less_Parser */ public function getLessCompiler( $vars = [] ) { + global $IP; // When called from the installer, it is possible that a required PHP extension // is missing (at least for now; see T49564). If this is the case, throw an // exception (caught by the installer) to prevent a fatal error later on. @@ -1720,9 +1721,9 @@ MESSAGE; $parser = new Less_Parser; $parser->ModifyVars( $vars ); - $parser->SetImportDirs( - array_fill_keys( $this->config->get( 'ResourceLoaderLESSImportPaths' ), '' ) - ); + $parser->SetImportDirs( [ + "$IP/resources/src/mediawiki.less/" => '', + ] ); $parser->SetOption( 'relativeUrls', false ); return $parser; diff --git a/resources/src/mediawiki.less/mediawiki.mixins.less b/resources/src/mediawiki.less/mediawiki.mixins.less index 53dccc2e07..55be237efe 100644 --- a/resources/src/mediawiki.less/mediawiki.mixins.less +++ b/resources/src/mediawiki.less/mediawiki.mixins.less @@ -1,6 +1,6 @@ // Common Less mixin library for MediaWiki // -// By default the folder containing this file is included in $wgResourceLoaderLESSImportPaths, +// By default the folder containing this file is included in the LESS import paths, // which makes this file importable by all less files via `@import 'mediawiki.mixins';`. // // The mixins included below are considered a public interface for MediaWiki extensions. diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php index 4ff7719cb7..e0b8c5e03c 100644 --- a/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php +++ b/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php @@ -8,7 +8,6 @@ class ResourceLoaderTest extends ResourceLoaderTestCase { parent::setUp(); $this->setMwGlobals( [ - 'wgResourceLoaderLESSImportPaths' => [], 'wgResourceLoaderLESSVars' => [ 'foo' => '2px', 'Foo' => '#eeeeee',