jenkins-bot has submitted this change and it was merged.

Change subject: Don't cache $wgResourceLoaderLESSVars in a static
......................................................................


Don't cache $wgResourceLoaderLESSVars in a static

Caching the value of $wgResourceLoaderLESSVars in a static variable that is
enclosed in a closure makes it harder to reset global state for test runs, and
it does so in the name of a performance benefit that is miniscule.

Change-Id: I0958b03818f56ab73c8c9124daa9e54cc59f2428
---
M includes/resourceloader/ResourceLoader.php
1 file changed, 3 insertions(+), 6 deletions(-)

Approvals:
  Hoo man: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/resourceloader/ResourceLoader.php 
b/includes/resourceloader/ResourceLoader.php
index eac6a02..6b8c7c4 100644
--- a/includes/resourceloader/ResourceLoader.php
+++ b/includes/resourceloader/ResourceLoader.php
@@ -1319,12 +1319,9 @@
        public static function getLESSVars() {
                global $wgResourceLoaderLESSVars;
 
-               static $lessVars = null;
-               if ( $lessVars === null ) {
-                       $lessVars = $wgResourceLoaderLESSVars;
-                       // Sort by key to ensure consistent hashing for cache 
lookups.
-                       ksort( $lessVars );
-               }
+               $lessVars = $wgResourceLoaderLESSVars;
+               // Sort by key to ensure consistent hashing for cache lookups.
+               ksort( $lessVars );
                return $lessVars;
        }
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I0958b03818f56ab73c8c9124daa9e54cc59f2428
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to