Remove deprecated wgResourceLoaderLESSImportPaths
authorTimo Tijhof <krinklemail@gmail.com>
Sat, 19 May 2018 18:37:21 +0000 (20:37 +0200)
committerTimo Tijhof <krinklemail@gmail.com>
Tue, 29 May 2018 14:49:28 +0000 (15:49 +0100)
The last remaining users of this feature were MobileFrontend and Minerva,
which have been migrated to direct imports.

Bug: T140807
Change-Id: I1a66a2ad314bde332297798520e5ec3e0e3d4c9b

RELEASE-NOTES-1.32
includes/DefaultSettings.php
includes/resourceloader/ResourceLoader.php
resources/src/mediawiki.less/mediawiki.mixins.less
tests/phpunit/includes/resourceloader/ResourceLoaderTest.php

index bef3653..9ce8de9 100644 (file)
@@ -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
index 1f55d32..562d887 100644 (file)
@@ -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.
index 1b8a4a8..f3b6a70 100644 (file)
@@ -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;
index 53dccc2..55be237 100644 (file)
@@ -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.
index 4ff7719..e0b8c5e 100644 (file)
@@ -8,7 +8,6 @@ class ResourceLoaderTest extends ResourceLoaderTestCase {
                parent::setUp();
 
                $this->setMwGlobals( [
-                       'wgResourceLoaderLESSImportPaths' => [],
                        'wgResourceLoaderLESSVars' => [
                                'foo'  => '2px',
                                'Foo' => '#eeeeee',