resourceloader: Set value for getVary in server-side
This change makes ResourceLoaderStorageVersion a private variable. The JavaScript global variable wgResourceLoaderStorageVersion is now removed. This change makes the JavaScript code smaller. Change-Id: I8e31b95d4c44ba653bedb6be500011a39bc6abd8
This commit is contained in:
parent
e2e2eb49d6
commit
0a8e37f042
2 changed files with 16 additions and 4 deletions
|
|
@ -105,7 +105,6 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
|
|||
'wgCaseSensitiveNamespaces' => $caseSensitiveNamespaces,
|
||||
'wgLegalTitleChars' => Title::convertByteClassToUnicodeClass( Title::legalChars() ),
|
||||
'wgIllegalFileChars' => Title::convertByteClassToUnicodeClass( $illegalFileChars ),
|
||||
'wgResourceLoaderStorageVersion' => $conf->get( 'ResourceLoaderStorageVersion' ),
|
||||
'wgResourceLoaderStorageEnabled' => $conf->get( 'ResourceLoaderStorageEnabled' ),
|
||||
'wgForeignUploadTargets' => $conf->get( 'ForeignUploadTargets' ),
|
||||
'wgEnableUploads' => $conf->get( 'EnableUploads' ),
|
||||
|
|
@ -367,6 +366,20 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
|
|||
return $baseModules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the key on which the JavaScript module cache (mw.loader.store) will vary.
|
||||
*
|
||||
* @param ResourceLoaderContext $context
|
||||
* @return string String of concatenated vary conditions
|
||||
*/
|
||||
private function getStoreVary( ResourceLoaderContext $context ) {
|
||||
return implode( ':', [
|
||||
$context->getSkin(),
|
||||
$this->getConfig()->get( 'ResourceLoaderStorageVersion' ),
|
||||
$context->getLanguage(),
|
||||
] );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ResourceLoaderContext $context
|
||||
* @return string JavaScript code
|
||||
|
|
@ -399,6 +412,7 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
|
|||
'$VARS.maxQueryLength' => ResourceLoader::encodeJsonForScript(
|
||||
$conf->get( 'ResourceLoaderMaxQueryLength' )
|
||||
),
|
||||
'$VARS.storeVary' => ResourceLoader::encodeJsonForScript( $this->getStoreVary( $context ) ),
|
||||
];
|
||||
$profilerStubs = [
|
||||
'$CODE.profileExecuteStart();' => 'mw.loader.profiler.onExecuteStart( module );',
|
||||
|
|
|
|||
|
|
@ -2170,9 +2170,7 @@
|
|||
* @return {string} String of concatenated vary conditions.
|
||||
*/
|
||||
getVary: function () {
|
||||
return mw.config.get( 'skin' ) + ':' +
|
||||
mw.config.get( 'wgResourceLoaderStorageVersion' ) + ':' +
|
||||
mw.config.get( 'wgUserLanguage' );
|
||||
return $VARS.storeVary;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue