From a9a5b2c2c4ad5a8b1111fe8ba2890dae8a3a89dd Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Tue, 26 Apr 2016 17:45:52 -0700 Subject: [PATCH] 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 --- includes/parser/ParserCache.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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" ); } } -- 2.20.1