X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fparser%2FParserCache.php;h=9e9654097595c63b92f62bb7249498a71cdb27ab;hb=840ac96e87870644ffb801476ff4f5f7c08352c5;hp=5876e0b258c522883ca89a4d7b1f3e68996cb52b;hpb=af349f79c8638927193f6bf52a101251e9eddbc3;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/parser/ParserCache.php b/includes/parser/ParserCache.php index 5876e0b258..9e96540975 100644 --- a/includes/parser/ParserCache.php +++ b/includes/parser/ParserCache.php @@ -72,12 +72,19 @@ class ParserCache { } /** - * @param WikiPage $article + * @param WikiPage $page * @return mixed|string */ - protected function getOptionsKey( $article ) { - $pageid = $article->getId(); - return wfMemcKey( 'pcache', 'idoptions', "{$pageid}" ); + protected function getOptionsKey( $page ) { + return wfMemcKey( 'pcache', 'idoptions', $page->getId() ); + } + + /** + * @param WikiPage $page + * @since 1.28 + */ + public function deleteOptionsKey( $page ) { + $this->mMemc->delete( $this->getOptionsKey( $page ) ); } /** @@ -150,7 +157,7 @@ class ParserCache { "Parser options key expired, touched " . $article->getTouched() . ", epoch $wgCacheEpoch, cached $cacheTime\n" ); return false; - } elseif ( $optionsKey->isDifferentRevision( $article->getLatest() ) ) { + } elseif ( !$useOutdated && $optionsKey->isDifferentRevision( $article->getLatest() ) ) { wfIncrStats( "pcache.miss.revid" ); $revId = $article->getLatest(); $cachedRevId = $optionsKey->getCacheRevisionId(); @@ -230,7 +237,7 @@ class ParserCache { "ParserOutput key expired, touched $touched, " . "epoch $wgCacheEpoch, cached $cacheTime\n" ); $value = false; - } elseif ( $value->isDifferentRevision( $article->getLatest() ) ) { + } elseif ( !$useOutdated && $value->isDifferentRevision( $article->getLatest() ) ) { wfIncrStats( "pcache.miss.revid" ); $revId = $article->getLatest(); $cachedRevId = $value->getCacheRevisionId(); @@ -262,7 +269,7 @@ class ParserCache { */ public function save( $parserOutput, $page, $popts, $cacheTime = null, $revId = null ) { $expire = $parserOutput->getCacheExpiry(); - if ( $expire > 0 ) { + if ( $expire > 0 && !$this->mMemc instanceof EmptyBagOStuff ) { $cacheTime = $cacheTime ?: wfTimestampNow(); if ( !$revId ) { $revision = $page->getRevision(); @@ -302,7 +309,7 @@ class ParserCache { 'ParserCacheSaveComplete', [ $this, $parserOutput, $page->getTitle(), $popts, $revId ] ); - } else { + } elseif ( $expire <= 0 ) { wfDebug( "Parser output was marked as uncacheable and has not been saved.\n" ); } }