cache = $cache; $this->cacheable = true; } /** * @return Status */ public function doWork() { // T371713: Temporary statistics collection code to determine // feasibility of Parsoid selective update $sampleRate = MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::ParsoidSelectiveUpdateSampleRate ); $doSample = ( $sampleRate && mt_rand( 1, $sampleRate ) === 1 ); // Reduce effects of race conditions for slow parses (T48014) $cacheTime = wfTimestampNow(); $status = $this->renderRevision( null, /* don't attempt Parsoid selective updates on this path */ $doSample, 'PoolWorkArticleViewOld' ); /** @var ParserOutput|null $output */ $output = $status->getValue(); if ( $output && $output->isCacheable() ) { $this->cache->save( $output, $this->revision, $this->parserOptions, $cacheTime ); } return $status; } /** * @return Status|false */ public function getCachedWork() { $parserOutput = $this->cache->get( $this->revision, $this->parserOptions ); return $parserOutput ? Status::newGood( $parserOutput ) : false; } } /** @deprecated class alias since 1.42 */ class_alias( PoolWorkArticleViewOld::class, 'PoolWorkArticleViewOld' );