From e176c76da2d8b304a4ae8726f92256fab2a7e83f Mon Sep 17 00:00:00 2001 From: Ori Livneh Date: Thu, 3 Sep 2015 17:38:05 -0700 Subject: [PATCH] resourceloader: Fully remove ResourceLoaderLESSFunctions Deprecated in 1.24, for reasons explained in a0c41ae39d. I don't see any usage in core or extensions. Change-Id: I46f9e04ae633e7ff1ee112b652e1865731172f1f --- RELEASE-NOTES-1.26 | 2 ++ docs/extension.schema.json | 4 ---- includes/DefaultSettings.php | 12 ------------ includes/resourceloader/ResourceLoader.php | 3 --- .../phpunit/data/less/common/test.common.mixins.less | 1 - tests/phpunit/data/less/module/styles.css | 1 - .../includes/resourceloader/ResourceLoaderTest.php | 9 --------- 7 files changed, 2 insertions(+), 30 deletions(-) diff --git a/RELEASE-NOTES-1.26 b/RELEASE-NOTES-1.26 index ddf6f7dc59..ff7f884fdd 100644 --- a/RELEASE-NOTES-1.26 +++ b/RELEASE-NOTES-1.26 @@ -27,6 +27,8 @@ production. MediaWiki 1.26, in where ResourceLoader became fully asynchronous. * $wgMasterWaitTimeout was removed (deprecated in 1.24). * Fields in ParserOptions are now private. Use the accessors instead. +* Custom LESS functions (defined via $wgResourceLoaderLESSFunctions) + have been removed, after being deprecated in 1.24. === New features in 1.26 === * (T51506) Now action=info gives estimates of actual watchers for a page. diff --git a/docs/extension.schema.json b/docs/extension.schema.json index 63bf1b5025..d11635d020 100644 --- a/docs/extension.schema.json +++ b/docs/extension.schema.json @@ -429,10 +429,6 @@ "type": "object", "description": "ResourceLoader LESS variables" }, - "ResourceLoaderLESSFunctions": { - "type": "object", - "description": "ResourceLoader LESS functions" - }, "ResourceLoaderLESSImportPaths": { "type": "object", "description": "ResourceLoader import paths" diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index f0450a9d74..06cd55a4ce 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -3636,18 +3636,6 @@ $wgResourceLoaderValidateStaticJS = false; */ $wgResourceLoaderLESSVars = array(); -/** - * Custom LESS functions. An associative array mapping function name to PHP - * callable. - * - * Changes to LESS functions do not trigger cache invalidation. - * - * @since 1.22 - * @deprecated since 1.24 Questionable usefulness and problematic to support, - * will be removed in the future. - */ -$wgResourceLoaderLESSFunctions = array(); - /** * Default import paths for LESS modules. LESS files referenced in @import * statements will be looked up here first, and relative to the importing file diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index 5fb6c96d5a..b8ec63bb29 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -1625,9 +1625,6 @@ MESSAGE; $less->setPreserveComments( true ); $less->setVariables( self::getLessVars( $config ) ); $less->setImportDir( $config->get( 'ResourceLoaderLESSImportPaths' ) ); - foreach ( $config->get( 'ResourceLoaderLESSFunctions' ) as $name => $func ) { - $less->registerFunction( $name, $func ); - } return $less; } diff --git a/tests/phpunit/data/less/common/test.common.mixins.less b/tests/phpunit/data/less/common/test.common.mixins.less index 2fbe9b79eb..40647291e1 100644 --- a/tests/phpunit/data/less/common/test.common.mixins.less +++ b/tests/phpunit/data/less/common/test.common.mixins.less @@ -1,5 +1,4 @@ .test-mixin (@value) { color: @value; border: @foo solid @Foo; - line-height: test-sum(@bar, 10, 20); } diff --git a/tests/phpunit/data/less/module/styles.css b/tests/phpunit/data/less/module/styles.css index b78780a903..e8099d10f1 100644 --- a/tests/phpunit/data/less/module/styles.css +++ b/tests/phpunit/data/less/module/styles.css @@ -2,5 +2,4 @@ .unit-tests { color: green; border: 2px solid #eeeeee; - line-height: 35; } diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php index cc20e7facf..b6838859c9 100644 --- a/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php +++ b/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php @@ -6,15 +6,6 @@ class ResourceLoaderTest extends ResourceLoaderTestCase { parent::setUp(); $this->setMwGlobals( array( - 'wgResourceLoaderLESSFunctions' => array( - 'test-sum' => function ( $frame, $less ) { - $sum = 0; - foreach ( $frame[2] as $arg ) { - $sum += (int)$arg[1]; - } - return $sum; - }, - ), 'wgResourceLoaderLESSImportPaths' => array( dirname( dirname( __DIR__ ) ) . '/data/less/common', ), -- 2.20.1