From 1476e9994bb8ddd74aaf2e386516d977e6de8894 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Wed, 6 Mar 2019 15:45:55 +0000 Subject: [PATCH] resourceloader: Use local var for getConfig() calls in StartUpModule Change-Id: I53af241454872fd228869b45dc74175c56026d6e --- includes/resourceloader/ResourceLoaderStartUpModule.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/includes/resourceloader/ResourceLoaderStartUpModule.php b/includes/resourceloader/ResourceLoaderStartUpModule.php index 334fc73261..16154ad7da 100644 --- a/includes/resourceloader/ResourceLoaderStartUpModule.php +++ b/includes/resourceloader/ResourceLoaderStartUpModule.php @@ -387,6 +387,8 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { */ public function getScript( ResourceLoaderContext $context ) { global $IP; + $conf = $this->getConfig(); + if ( $context->getOnly() !== 'scripts' ) { return '/* Requires only=script */'; } @@ -400,7 +402,7 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { if ( $context->getDebug() ) { $mwLoaderCode .= file_get_contents( "$IP/resources/src/startup/mediawiki.log.js" ); } - if ( $this->getConfig()->get( 'ResourceLoaderEnableJSProfiler' ) ) { + if ( $conf->get( 'ResourceLoaderEnableJSProfiler' ) ) { $mwLoaderCode .= file_get_contents( "$IP/resources/src/startup/profiler.js" ); } @@ -414,7 +416,7 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { '$CODE.profileScriptStart();' => 'mw.loader.profiler.onScriptStart( module );', '$CODE.profileScriptEnd();' => 'mw.loader.profiler.onScriptEnd( module );', ]; - if ( $this->getConfig()->get( 'ResourceLoaderEnableJSProfiler' ) ) { + if ( $conf->get( 'ResourceLoaderEnableJSProfiler' ) ) { // When profiling is enabled, insert the calls. $mwLoaderPairs += $profilerStubs; } else { @@ -426,7 +428,7 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { // Perform string replacements for startup.js $pairs = [ '$VARS.wgLegacyJavaScriptGlobals' => ResourceLoader::encodeJsonForScript( - $this->getConfig()->get( 'LegacyJavaScriptGlobals' ) + $conf->get( 'LegacyJavaScriptGlobals' ) ), '$VARS.configuration' => ResourceLoader::encodeJsonForScript( $this->getConfigSettings( $context ) -- 2.20.1