Jdlrobson has uploaded a new change for review.
https://gerrit.wikimedia.org/r/263006
Change subject: Add ResourceLoader::resetLessVars method
......................................................................
Add ResourceLoader::resetLessVars method
Currently LESS variables are cached on first lookup. Whenever the
environment changes, it is necessary thus to refresh them e.g. for
variables introduced via an extension.
This also allows tests to run whenever ResourceLoaderLESSVars is different
to an empty array
(note !array() == true)
Change-Id: Ie1cdc9518624340bb63863cdb1a3ac20eccb5951
---
M includes/resourceloader/ResourceLoader.php
M tests/phpunit/includes/resourceloader/ResourceLoaderTest.php
2 files changed, 9 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/06/263006/1
diff --git a/includes/resourceloader/ResourceLoader.php
b/includes/resourceloader/ResourceLoader.php
index 1f3085a..1c2d31e 100644
--- a/includes/resourceloader/ResourceLoader.php
+++ b/includes/resourceloader/ResourceLoader.php
@@ -1615,6 +1615,14 @@
}
/**
+ * Resets any cached LESS variables
+ *
+ */
+ public static function resetLessVars() {
+ self::$lessVars = null;
+ }
+
+ /**
* Get global LESS variables.
*
* @param Config $config
diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php
b/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php
index b683885..c785535 100644
--- a/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php
+++ b/tests/phpunit/includes/resourceloader/ResourceLoaderTest.php
@@ -5,6 +5,7 @@
protected function setUp() {
parent::setUp();
+ ResourceLoader::resetLessVars();
$this->setMwGlobals( array(
'wgResourceLoaderLESSImportPaths' => array(
dirname( dirname( __DIR__ ) ) .
'/data/less/common',
--
To view, visit https://gerrit.wikimedia.org/r/263006
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie1cdc9518624340bb63863cdb1a3ac20eccb5951
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits