From: Ori Livneh Date: Fri, 18 Apr 2014 19:11:42 +0000 (-0700) Subject: Don't cache $wgResourceLoaderLESSVars in a static X-Git-Tag: 1.31.0-rc.0~16150^2~1 X-Git-Url: https://git.cyclocoop.org/%7B%7B%20url_for%28%27user_edit%27%2C%20userid=session.user.id%29%20%7D%7D?a=commitdiff_plain;h=a2bf2346cdaa4b4dce7b005f20220c3ceb56f6bb;p=lhc%2Fweb%2Fwiklou.git 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 --- diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index eac6a02f63..6b8c7c4faa 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -1319,12 +1319,9 @@ class ResourceLoader { 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; } }