From: Kunal Mehta Date: Wed, 27 Apr 2016 00:45:52 +0000 (-0700) Subject: ParserCache: Don't try to save to nothing if disabled X-Git-Tag: 1.31.0-rc.0~7120^2 X-Git-Url: http://git.cyclocoop.org/%22.htmlspecialchars%28%24url_syndic%29.%22?a=commitdiff_plain;h=a9a5b2c2c4ad5a8b1111fe8ba2890dae8a3a89dd;p=lhc%2Fweb%2Fwiklou.git ParserCache: Don't try to save to nothing if disabled If the ParserCache is disabled via $wgParserCacheType = CACHE_NONE, don't bother trying to save anything because it won't do anything. This also removes the misleading "Saved in parser cache" HTML comment from the rendered output since it isn't being saved at all. Change-Id: I5603d2b2866f0079cdcd837b1f1a4efc00bc8ed9 --- diff --git a/includes/parser/ParserCache.php b/includes/parser/ParserCache.php index 916cfc26a1..f77a30fea9 100644 --- a/includes/parser/ParserCache.php +++ b/includes/parser/ParserCache.php @@ -257,7 +257,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(); @@ -297,7 +297,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" ); } }