From: jenkins-bot Date: Tue, 29 May 2018 17:19:23 +0000 (+0000) Subject: Merge "Remove deprecated wgResourceLoaderLESSImportPaths" X-Git-Tag: 1.34.0-rc.0~5266 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/pie.php?a=commitdiff_plain;h=ae9898e53675da194939a3ef9d2b82e24c04b380;hp=7ee4dbd7e6dfdc0895284c844d87514c2f72e6cb;p=lhc%2Fweb%2Fwiklou.git Merge "Remove deprecated wgResourceLoaderLESSImportPaths" --- diff --git a/RELEASE-NOTES-1.32 b/RELEASE-NOTES-1.32 index 6486302341..b016d0bf5c 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',