}
/**
- * @param Article $article
+ * @param WikiPage $article
* @param string $hash
* @return mixed|string
*/
}
/**
- * @param Article $article
+ * @param WikiPage $article
* @return mixed|string
*/
protected function getOptionsKey( $article ) {
* English preferences. That's why we take into account *all* user
* options. (r70809 CR)
*
- * @param Article $article
+ * @param WikiPage $article
* @param ParserOptions $popts
* @return string
*/
/**
* Retrieve the ParserOutput from ParserCache, even if it's outdated.
- * @param Article $article
+ * @param WikiPage $article
* @param ParserOptions $popts
* @return ParserOutput|bool False on failure
*/
*
* @todo Document parameter $useOutdated
*
- * @param Article $article
+ * @param WikiPage $article
* @param ParserOptions $popts
* @param bool $useOutdated (default true)
* @return bool|mixed|string
$optionsKey = $this->mMemc->get( $this->getOptionsKey( $article ) );
if ( $optionsKey != false ) {
if ( !$useOutdated && $optionsKey->expired( $article->getTouched() ) ) {
- wfIncrStats( "pcache_miss_expired" );
+ wfIncrStats( "pcache.miss.expired" );
$cacheTime = $optionsKey->getCacheTime();
wfDebug( "Parser options key expired, touched " . $article->getTouched()
. ", epoch $wgCacheEpoch, cached $cacheTime\n" );
return false;
} elseif ( $optionsKey->isDifferentRevision( $article->getLatest() ) ) {
- wfIncrStats( "pcache_miss_revid" );
+ wfIncrStats( "pcache.miss.revid" );
$revId = $article->getLatest();
$cachedRevId = $optionsKey->getCacheRevisionId();
wfDebug( "ParserOutput key is for an old revision, latest $revId, cached $cachedRevId\n" );
* Retrieve the ParserOutput from ParserCache.
* false if not found or outdated.
*
- * @param Article $article
+ * @param WikiPage $article
* @param ParserOptions $popts
* @param bool $useOutdated (default false)
*
$parserOutputKey = $this->getKey( $article, $popts, $useOutdated );
if ( $parserOutputKey === false ) {
- wfIncrStats( 'pcache_miss_absent' );
+ wfIncrStats( 'pcache.miss.absent' );
return false;
}
$value = $this->mMemc->get( $parserOutputKey );
if ( !$value ) {
wfDebug( "ParserOutput cache miss.\n" );
- wfIncrStats( "pcache_miss_absent" );
+ wfIncrStats( "pcache.miss.absent" );
return false;
}
$value->setEditSectionTokens( $popts->getEditSection() );
if ( !$useOutdated && $value->expired( $touched ) ) {
- wfIncrStats( "pcache_miss_expired" );
+ wfIncrStats( "pcache.miss.expired" );
$cacheTime = $value->getCacheTime();
wfDebug( "ParserOutput key expired, touched $touched, "
. "epoch $wgCacheEpoch, cached $cacheTime\n" );
$value = false;
} elseif ( $value->isDifferentRevision( $article->getLatest() ) ) {
- wfIncrStats( "pcache_miss_revid" );
+ wfIncrStats( "pcache.miss.revid" );
$revId = $article->getLatest();
$cachedRevId = $value->getCacheRevisionId();
wfDebug( "ParserOutput key is for an old revision, latest $revId, cached $cachedRevId\n" );
$value = false;
} else {
- wfIncrStats( "pcache_hit" );
+ wfIncrStats( "pcache.hit" );
}
return $value;
$optionsKey->setCacheRevisionId( $revId );
$parserOutput->setCacheRevisionId( $revId );
- $optionsKey->setContainsOldMagic( $parserOutput->containsOldMagic() );
-
$parserOutputKey = $this->getParserOutputKey( $page,
$popts->optionsHash( $optionsKey->mUsedOptions, $page->getTitle() ) );
// ...and its pointer
$this->mMemc->set( $this->getOptionsKey( $page ), $optionsKey, $expire );
+
+ Hooks::run( 'ParserCacheSaveComplete', array( $this, $parserOutput, $page->getTitle(), $popts, $revId ) );
} else {
wfDebug( "Parser output was marked as uncacheable and has not been saved.\n" );
}