From 93f968cef8fb37993ca37bc05f337722285609bf Mon Sep 17 00:00:00 2001 From: Rob Church Date: Sat, 13 May 2006 17:40:59 +0000 Subject: [PATCH] (bug 5683) Respect parser output marked as uncacheable when saving --- RELEASE-NOTES | 1 + includes/Parser.php | 1 + includes/ParserCache.php | 34 +++++++++++++++++++++------------- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index eeb9fcb4ec..750e175a69 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -256,6 +256,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Introduce NUMBEROFPAGES magic word * (bug 5833) Introduce CURRENTVERSION magic word * (bug 5370) Allow throttling of password reminder requests with the rate limiter +* (bug 5683) Respect parser output marked as uncacheable when saving == Compatibility == diff --git a/includes/Parser.php b/includes/Parser.php index 456487104a..ec6f11e2db 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -4040,6 +4040,7 @@ class Parser * shouldn't be cached. */ function disableCache() { + wfDebug( "Parser output marked as uncacheable.\n" ); $this->mOutput->mCacheTime = -1; } diff --git a/includes/ParserCache.php b/includes/ParserCache.php index 712c664cdf..3ec7512fca 100644 --- a/includes/ParserCache.php +++ b/includes/ParserCache.php @@ -97,23 +97,31 @@ class ParserCache { function save( $parserOutput, &$article, &$user ){ global $wgParserCacheExpireTime; $key = $this->getKey( $article, $user ); - $now = wfTimestampNow(); - $parserOutput->setCacheTime( $now ); - - // Save the timestamp so that we don't have to load the revision row on view - $parserOutput->mTimestamp = $article->getTimestamp(); - $parserOutput->mText .= "\n\n"; - wfDebug( "Saved in parser cache with key $key and timestamp $now\n" ); - - if( $parserOutput->containsOldMagic() ){ - $expire = 3600; # 1 hour + if( $parserOutput->getCacheTime() != -1 ) { + + $now = wfTimestampNow(); + $parserOutput->setCacheTime( $now ); + + // Save the timestamp so that we don't have to load the revision row on view + $parserOutput->mTimestamp = $article->getTimestamp(); + + $parserOutput->mText .= "\n\n"; + wfDebug( "Saved in parser cache with key $key and timestamp $now\n" ); + + if( $parserOutput->containsOldMagic() ){ + $expire = 3600; # 1 hour + } else { + $expire = $wgParserCacheExpireTime; + } + $this->mMemc->set( $key, $parserOutput, $expire ); + } else { - $expire = $wgParserCacheExpireTime; + wfDebug( "Parser output was marked as uncacheable and has not been saved.\n" ); } - $this->mMemc->set( $key, $parserOutput, $expire ); + } + } - ?> -- 2.20.1