(bug 5683) Respect parser output marked as uncacheable when saving
This commit is contained in:
parent
caed2785eb
commit
93f968cef8
3 changed files with 23 additions and 13 deletions
|
|
@ -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 ==
|
||||
|
||||
|
|
|
|||
|
|
@ -4040,6 +4040,7 @@ class Parser
|
|||
* shouldn't be cached.
|
||||
*/
|
||||
function disableCache() {
|
||||
wfDebug( "Parser output marked as uncacheable.\n" );
|
||||
$this->mOutput->mCacheTime = -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<!-- Saved in parser cache with key $key and timestamp $now -->\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<!-- Saved in parser cache with key $key and timestamp $now -->\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 );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
|
|
|||
Loading…
Reference in a new issue