r14201 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r14200‎ | r14201 | r14202 >
Date:17:40, 13 May 2006
Author:robchurch
Status:old
Tags:
Comment:
(bug 5683) Respect parser output marked as uncacheable when saving
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Parser.php (modified) (history)
  • /trunk/phase3/includes/ParserCache.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Parser.php
@@ -4040,6 +4040,7 @@
40414041 * shouldn't be cached.
40424042 */
40434043 function disableCache() {
 4044+ wfDebug( "Parser output marked as uncacheable.\n" );
40444045 $this->mOutput->mCacheTime = -1;
40454046 }
40464047
Index: trunk/phase3/includes/ParserCache.php
@@ -97,23 +97,31 @@
9898 function save( $parserOutput, &$article, &$user ){
9999 global $wgParserCacheExpireTime;
100100 $key = $this->getKey( $article, $user );
101 - $now = wfTimestampNow();
102 - $parserOutput->setCacheTime( $now );
103 -
104 - // Save the timestamp so that we don't have to load the revision row on view
105 - $parserOutput->mTimestamp = $article->getTimestamp();
106101
107 - $parserOutput->mText .= "\n<!-- Saved in parser cache with key $key and timestamp $now -->\n";
108 - wfDebug( "Saved in parser cache with key $key and timestamp $now\n" );
109 -
110 - if( $parserOutput->containsOldMagic() ){
111 - $expire = 3600; # 1 hour
 102+ if( $parserOutput->getCacheTime() != -1 ) {
 103+
 104+ $now = wfTimestampNow();
 105+ $parserOutput->setCacheTime( $now );
 106+
 107+ // Save the timestamp so that we don't have to load the revision row on view
 108+ $parserOutput->mTimestamp = $article->getTimestamp();
 109+
 110+ $parserOutput->mText .= "\n<!-- Saved in parser cache with key $key and timestamp $now -->\n";
 111+ wfDebug( "Saved in parser cache with key $key and timestamp $now\n" );
 112+
 113+ if( $parserOutput->containsOldMagic() ){
 114+ $expire = 3600; # 1 hour
 115+ } else {
 116+ $expire = $wgParserCacheExpireTime;
 117+ }
 118+ $this->mMemc->set( $key, $parserOutput, $expire );
 119+
112120 } else {
113 - $expire = $wgParserCacheExpireTime;
 121+ wfDebug( "Parser output was marked as uncacheable and has not been saved.\n" );
114122 }
115 - $this->mMemc->set( $key, $parserOutput, $expire );
 123+
116124 }
 125+
117126 }
118127
119 -
120128 ?>
Index: trunk/phase3/RELEASE-NOTES
@@ -256,6 +256,7 @@
257257 * Introduce NUMBEROFPAGES magic word
258258 * (bug 5833) Introduce CURRENTVERSION magic word
259259 * (bug 5370) Allow throttling of password reminder requests with the rate limiter
 260+* (bug 5683) Respect parser output marked as uncacheable when saving
260261
261262 == Compatibility ==
262263

Status & tagging log