X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fcache%2FMessageCache.php;h=b0716b18b3934dfe4f6f98f8fa27d4d1cf8064dc;hb=c27085dd72271966b4b8de29e52878c7fccef1bf;hp=157d88eb34da27cd16dbaee86fc82b27a69bb7b1;hpb=a422c80a236cd178eb66500007bf204492f24234;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/cache/MessageCache.php b/includes/cache/MessageCache.php index 157d88eb34..b0716b18b3 100644 --- a/includes/cache/MessageCache.php +++ b/includes/cache/MessageCache.php @@ -217,7 +217,7 @@ class MessageCache { /** * Try to load the cache from APC. * - * @param string $code Optional language code, see documenation of load(). + * @param string $code Optional language code, see documentation of load(). * @return array|bool The cache array, or false if not in cache. */ protected function getLocalCache( $code ) { @@ -342,7 +342,7 @@ class MessageCache { } elseif ( $hashVolatile ) { # DB results are replica DB lag prone until the holdoff TTL passes. # By then, updates should be reflected in loadFromDBWithLock(). - # One thread renerates the cache while others use old values. + # One thread regenerates the cache while others use old values. $where[] = 'global cache is expired/volatile'; $staleCache = $cache; } else { @@ -379,7 +379,7 @@ class MessageCache { break; } elseif ( $loadStatus === 'cantacquire' ) { # Wait for the other thread to finish, then retry. Normally, - # the memcached get() will then yeild the other thread's result. + # the memcached get() will then yield the other thread's result. $where[] = 'waited for other thread to complete'; $this->getReentrantScopedLock( $cacheKey ); } else { @@ -718,8 +718,7 @@ class MessageCache { $this->wanCache->touchCheckKey( $this->getCheckKey( $code ) ); // Purge the messages in the message blob store and fire any hook handlers - $resourceloader = RequestContext::getMain()->getOutput()->getResourceLoader(); - $blobStore = $resourceloader->getMessageBlobStore(); + $blobStore = MediaWikiServices::getInstance()->getResourceLoader()->getMessageBlobStore(); foreach ( $replacements as list( $title, $msg ) ) { $blobStore->updateMessage( $this->contLang->lcfirst( $msg ) ); Hooks::run( 'MessageCacheReplace', [ $title, $newTextByTitle[$title] ] ); @@ -1203,18 +1202,18 @@ class MessageCache { * @return Parser */ public function getParser() { - global $wgParser, $wgParserConf; - - if ( !$this->mParser && isset( $wgParser ) ) { + global $wgParserConf; + if ( !$this->mParser ) { + $parser = MediaWikiServices::getInstance()->getParser(); # Do some initialisation so that we don't have to do it twice - $wgParser->firstCallInit(); + $parser->firstCallInit(); # Clone it and store it $class = $wgParserConf['class']; if ( $class == ParserDiffTest::class ) { # Uncloneable $this->mParser = new $class( $wgParserConf ); } else { - $this->mParser = clone $wgParser; + $this->mParser = clone $parser; } }