* @file
*/
use MediaWiki\Logger\LoggerFactory;
+use MediaWiki\MediaWikiServices;
/**
* API interface for page purging
$r['linkupdate'] = true;
if ( $enableParserCache ) {
- $pcache = ParserCache::singleton();
+ $pcache = MediaWikiServices::getInstance()->getParserCache();
$pcache->save( $p_result, $page, $popts );
}
}
if ( $page->getTouched() >= $this->params['rootJobTimestamp'] || $opportunistic ) {
// Cache is suspected to be up-to-date. As long as the cache rev ID matches
// and it reflects the job's triggering change, then it is usable.
- $parserOutput = ParserCache::singleton()->getDirty( $page, $parserOptions );
+ $parserOutput = $services->getParserCache()->getDirty( $page, $parserOptions );
if ( !$parserOutput
|| $parserOutput->getCacheRevisionId() != $revision->getId()
|| $parserOutput->getCacheTime() < $skewedTimestamp
&& $parserOutput->isCacheable()
) {
$ctime = wfTimestamp( TS_MW, (int)$start ); // cache time
- ParserCache::singleton()->save(
+ $services->getParserCache()->save(
$parserOutput, $page, $parserOptions, $ctime, $revision->getId()
);
}
# Allow frames by default
$outputPage->allowClickjacking();
- $parserCache = ParserCache::singleton();
+ $parserCache = MediaWikiServices::getInstance()->getParserCache();
$parserOptions = $this->getParserOptions();
# Render printable version, use printable version cache
}
if ( $useParserCache ) {
- $parserOutput = ParserCache::singleton()->get( $this, $parserOptions );
+ $parserOutput = MediaWikiServices::getInstance()->getParserCache()
+ ->get( $this, $parserOptions );
if ( $parserOutput !== false ) {
return $parserOutput;
}
// Save it to the parser cache.
// Make sure the cache time matches page_touched to avoid double parsing.
- ParserCache::singleton()->save(
+ MediaWikiServices::getInstance()->getParserCache()->save(
$editInfo->output, $this, $editInfo->popts,
$revision->getTimestamp(), $editInfo->revid
);
*
* @file
*/
+use MediaWiki\MediaWikiServices;
class PoolWorkArticleView extends PoolCounterWork {
/** @var WikiPage */
/** @var int */
private $revid;
+ /** @var ParserCache */
+ private $parserCache;
+
/** @var ParserOptions */
private $parserOptions;
$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 );
}
}
if ( $this->cacheable && $this->parserOutput->isCacheable() && $isCurrent ) {
- ParserCache::singleton()->save(
+ $this->parserCache->save(
$this->parserOutput, $this->page, $this->parserOptions, $cacheTime, $this->revid );
}
* @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" );
* @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' );
require_once __DIR__ . '/Maintenance.php';
+use MediaWiki\MediaWikiServices;
+
/**
* @ingroup Maintenance
*/
$scanned = 0;
$withcache = 0;
$withdiff = 0;
+ $parserCache = MediaWikiServices::getInstance()->getParserCache();
while ( $pages-- > 0 ) {
$row = $dbr->selectRow( 'page', '*',
[
$parserOptions = $page->makeParserOptions( 'canonical' );
- $parserOutputOld = ParserCache::singleton()->get( $page, $parserOptions );
+ $parserOutputOld = $parserCache->get( $page, $parserOptions );
if ( $parserOutputOld ) {
$t1 = microtime( true );