X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fresourceloader%2FResourceLoaderModule.php;h=a7fee8546b0b66f87b8bf7a3427a7562a718ce7e;hb=4821c63624e123043bddc54293cf6a286505955e;hp=66a4edfb1c6ae73dfe901efcfdfaff44c84fc9e4;hpb=70dd429741fc97492d818c28bed6a6e58a70595a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/resourceloader/ResourceLoaderModule.php b/includes/resourceloader/ResourceLoaderModule.php index 66a4edfb1c..a7fee8546b 100644 --- a/includes/resourceloader/ResourceLoaderModule.php +++ b/includes/resourceloader/ResourceLoaderModule.php @@ -146,10 +146,7 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface { if ( is_string( $deprecationInfo ) ) { $warning .= "\n" . $deprecationInfo; } - return Xml::encodeJsCall( - 'mw.log.warn', - [ $warning ] - ); + return 'mw.log.warn(' . ResourceLoader::encodeJsonForScript( $warning ) . ');'; } else { return ''; } @@ -412,7 +409,7 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface { * @return array List of files */ protected function getFileDependencies( ResourceLoaderContext $context ) { - $vary = $context->getSkin() . '|' . $context->getLanguage(); + $vary = self::getVary( $context ); // Try in-object cache first if ( !isset( $this->fileDeps[$vary] ) ) { @@ -447,7 +444,7 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface { * @param string[] $files Array of file names */ public function setFileDependencies( ResourceLoaderContext $context, $files ) { - $vary = $context->getSkin() . '|' . $context->getLanguage(); + $vary = self::getVary( $context ); $this->fileDeps[$vary] = $files; } @@ -484,7 +481,7 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface { } // The file deps list has changed, we want to update it. - $vary = $context->getSkin() . '|' . $context->getLanguage(); + $vary = self::getVary( $context ); $cache = ObjectCache::getLocalClusterInstance(); $key = $cache->makeKey( __METHOD__, $this->getName(), $vary ); $scopeLock = $cache->getScopedLock( $key, 0 ); @@ -954,8 +951,7 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface { $cache = MediaWikiServices::getInstance()->getMainWANObjectCache(); return $cache->getWithSetCallback( $cache->makeGlobalKey( - 'resourceloader', - 'jsparse', + 'resourceloader-jsparse', self::$parseCacheVersion, md5( $contents ), $fileName @@ -1021,4 +1017,18 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface { protected static function safeFileHash( $filePath ) { return FileContentsHasher::getFileContentsHash( $filePath ); } + + /** + * Get vary string. + * + * @internal For internal use only. + * @param ResourceLoaderContext $context + * @return string Vary string + */ + public static function getVary( ResourceLoaderContext $context ) { + return implode( '|', [ + $context->getSkin(), + $context->getLanguage(), + ] ); + } }