X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fpoolcounter%2FPoolWorkArticleView.php;h=17b62d77f87182d1ac63cd67ae43fb1d86d697d6;hb=e0b2787dae749ba3d4cb18bc9b3fe789db69046f;hp=534e86b6bead93ab0a443165808e03258b9a8b9d;hpb=b8da5c83743ea31c6f73c063508384f114748537;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/poolcounter/PoolWorkArticleView.php b/includes/poolcounter/PoolWorkArticleView.php index 534e86b6be..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 ); } @@ -129,7 +134,7 @@ class PoolWorkArticleView extends PoolCounterWork { return false; } - // Reduce effects of race conditions for slow parses (bug 46014) + // Reduce effects of race conditions for slow parses (T48014) $cacheTime = wfTimestampNow(); $time = - microtime( true ); @@ -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' );