Save the last modified timestamp to the parser cache, to avoid the need for a revisio...
authorTim Starling <tstarling@users.mediawiki.org>
Thu, 16 Mar 2006 02:57:44 +0000 (02:57 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Thu, 16 Mar 2006 02:57:44 +0000 (02:57 +0000)
includes/OutputPage.php
includes/ParserCache.php

index 3517e45..b90faf8 100644 (file)
@@ -360,7 +360,7 @@ class OutputPage {
         *
         * @return bool
         */
-       function tryParserCache( $article, $user ) {
+       function tryParserCache( &$article, $user ) {
                $parserCache =& ParserCache::singleton();
                $parserOutput = $parserCache->get( $article, $user );
                if ( $parserOutput !== false ) {
index d9a7c84..712c664 100644 (file)
@@ -78,8 +78,10 @@ class ParserCache {
                                }
                                $this->mMemc->delete( $key );
                                $value = false;
-
                        } else {
+                               if ( isset( $value->mTimestamp ) ) {
+                                       $article->mTimestamp = $value->mTimestamp;
+                               }
                                wfIncrStats( "pcache_hit" );
                        }
                } else {
@@ -97,6 +99,10 @@ class ParserCache {
                $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" );