X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fresourceloader%2FResourceLoaderStartUpModule.php;h=7880f6f2494b4e7634b558eaa8134df5a98f7ab3;hb=9c36c584ffe4c4650083bd158b13ce2efde34268;hp=2959b22be0f9ca259e03e1508722692d41c4b192;hpb=2586339be2c2be12dcf67c64d7f663d0e632c664;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/resourceloader/ResourceLoaderStartUpModule.php b/includes/resourceloader/ResourceLoaderStartUpModule.php index 2959b22be0..7880f6f249 100644 --- a/includes/resourceloader/ResourceLoaderStartUpModule.php +++ b/includes/resourceloader/ResourceLoaderStartUpModule.php @@ -70,7 +70,6 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { // Build list of variables $skin = $context->getSkin(); $vars = [ - 'wgLoadScript' => $conf->get( 'LoadScript' ), 'debug' => $context->getDebug(), 'skin' => $skin, 'stylepath' => $conf->get( 'StylePath' ), @@ -106,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' ), @@ -368,6 +366,30 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { return $baseModules; } + /** + * Get the localStorage key for the entire module store. The key references + * $wgDBname to prevent clashes between wikis under the same web domain. + * + * @return string localStorage item key for JavaScript + */ + private function getStoreKey() { + return 'MediaWikiModuleStore:' . $this->getConfig()->get( 'DBname' ); + } + + /** + * 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 @@ -400,6 +422,8 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { '$VARS.maxQueryLength' => ResourceLoader::encodeJsonForScript( $conf->get( 'ResourceLoaderMaxQueryLength' ) ), + '$VARS.storeKey' => ResourceLoader::encodeJsonForScript( $this->getStoreKey() ), + '$VARS.storeVary' => ResourceLoader::encodeJsonForScript( $this->getStoreVary( $context ) ), ]; $profilerStubs = [ '$CODE.profileExecuteStart();' => 'mw.loader.profiler.onExecuteStart( module );',