Jdlrobson has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/263147

Change subject: Do not cache less variables in static function
......................................................................

Do not cache less variables in static function

This is a micro-optimisation that will cache LESS variables
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: I95506b8bb20a4b2b3f82014a7b0fcee5f28973e6
---
M includes/resourceloader/ResourceLoader.php
1 file changed, 3 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/47/263147/1

diff --git a/includes/resourceloader/ResourceLoader.php 
b/includes/resourceloader/ResourceLoader.php
index 1f3085a..71f3481 100644
--- a/includes/resourceloader/ResourceLoader.php
+++ b/includes/resourceloader/ResourceLoader.php
@@ -1622,11 +1622,8 @@
         * @return array Map of variable names to string CSS values.
         */
        public static function getLessVars( Config $config ) {
-               if ( !self::$lessVars ) {
-                       $lessVars = $config->get( 'ResourceLoaderLESSVars' );
-                       Hooks::run( 'ResourceLoaderGetLessVars', array( 
&$lessVars ) );
-                       self::$lessVars = $lessVars;
-               }
-               return self::$lessVars;
+               $lessVars = $config->get( 'ResourceLoaderLESSVars' );
+               Hooks::run( 'ResourceLoaderGetLessVars', array( &$lessVars ) );
+               return $lessVars;
        }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/263147
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I95506b8bb20a4b2b3f82014a7b0fcee5f28973e6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <jrob...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to