X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fpoolcounter%2FPoolWorkArticleView.php;h=17b62d77f87182d1ac63cd67ae43fb1d86d697d6;hb=818e93ed2b822cd9cbae25046d6e4ab55d999aee;hp=1f1add7924e4b4f80dbc77bdb2a5ad0754f7a28b;hpb=bdfa96eb726c9997a010f5a194eec71925bfddc2;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/poolcounter/PoolWorkArticleView.php b/includes/poolcounter/PoolWorkArticleView.php index 1f1add7924..17b62d77f8 100644 --- a/includes/poolcounter/PoolWorkArticleView.php +++ b/includes/poolcounter/PoolWorkArticleView.php @@ -17,6 +17,7 @@ * * @file */ +use MediaWiki\MediaWikiServices; class PoolWorkArticleView extends PoolCounterWork { /** @var WikiPage */ @@ -28,6 +29,9 @@ class PoolWorkArticleView extends PoolCounterWork { /** @var int */ private $revid; + /** @var ParserCache */ + private $parserCache; + /** @var ParserOptions */ private $parserOptions; @@ -66,7 +70,8 @@ class PoolWorkArticleView extends PoolCounterWork { $this->cacheable = $useParserCache; $this->parserOptions = $parserOptions; $this->content = $content; - $this->cacheKey = ParserCache::singleton()->getKey( $page, $parserOptions ); + $this->parserCache = MediaWikiServices::getInstance()->getParserCache(); + $this->cacheKey = $this->parserCache->getKey( $page, $parserOptions ); $keyPrefix = $this->cacheKey ?: wfMemcKey( 'articleview', 'missingcachekey' ); parent::__construct( 'ArticleView', $keyPrefix . ':revid:' . $revid ); } @@ -153,7 +158,7 @@ class PoolWorkArticleView extends PoolCounterWork { } if ( $this->cacheable && $this->parserOutput->isCacheable() && $isCurrent ) { - ParserCache::singleton()->save( + $this->parserCache->save( $this->parserOutput, $this->page, $this->parserOptions, $cacheTime, $this->revid ); } @@ -175,7 +180,7 @@ class PoolWorkArticleView extends PoolCounterWork { * @return bool */ public function getCachedWork() { - $this->parserOutput = ParserCache::singleton()->get( $this->page, $this->parserOptions ); + $this->parserOutput = $this->parserCache->get( $this->page, $this->parserOptions ); if ( $this->parserOutput === false ) { wfDebug( __METHOD__ . ": parser cache miss\n" ); @@ -190,7 +195,7 @@ class PoolWorkArticleView extends PoolCounterWork { * @return bool */ public function fallback() { - $this->parserOutput = ParserCache::singleton()->getDirty( $this->page, $this->parserOptions ); + $this->parserOutput = $this->parserCache->getDirty( $this->page, $this->parserOptions ); if ( $this->parserOutput === false ) { wfDebugLog( 'dirty', 'dirty missing' );