(bug 5683) Respect parser output marked as uncacheable when saving
authorRob Church <robchurch@users.mediawiki.org>
Sat, 13 May 2006 17:40:59 +0000 (17:40 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Sat, 13 May 2006 17:40:59 +0000 (17:40 +0000)
RELEASE-NOTES
includes/Parser.php
includes/ParserCache.php

index eeb9fcb..750e175 100644 (file)
@@ -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 ==
 
index 4564871..ec6f11e 100644 (file)
@@ -4040,6 +4040,7 @@ class Parser
         * shouldn't be cached.
         */
        function disableCache() {
+               wfDebug( "Parser output marked as uncacheable.\n" );
                $this->mOutput->mCacheTime = -1;
        }
 
index 712c664..3ec7512 100644 (file)
@@ -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 );
+               
        }
+       
 }
 
-
 ?>