BUG#463 Strip first leading blank from preformatted text in output
[lhc/web/wiklou.git] / includes / ParserCache.php
index b96bff1..23349a8 100644 (file)
@@ -1,5 +1,13 @@
 <?php
+/**
+ *
+ * @package MediaWiki
+ */
 
+/**
+ *
+ * @package MediaWiki
+ */
 class ParserCache
 {
        function getKey( &$article, &$user ) {
@@ -12,7 +20,7 @@ class ParserCache
        
        function get( &$article, &$user ) {
                global $wgMemc, $wgCacheEpoch;
-               $fname = "ParserCache::get";
+               $fname = 'ParserCache::get';
                wfProfileIn( $fname );
 
                $hash = $user->getPageRenderingHash();
@@ -23,10 +31,15 @@ class ParserCache
                if ( $value ) {
                        wfDebug( "Found.\n" );
                        # Delete if article has changed since the cache was made
-                       $touched = $article->getTouched();
+                       $canCache = $article->checkTouched();
                        $cacheTime = $value->getCacheTime();
-                       if ( $value->getCacheTime() <= $touched || $cacheTime < $wgCacheEpoch ) {
-                               wfDebug( "Key expired, touched $touched, epoch $wgCacheEpoch, cached $cacheTime\n" );
+                       $touched = $article->mTouched;
+                       if ( !$canCache || $value->getCacheTime() <= $touched || $cacheTime < $wgCacheEpoch ) {
+                               if ( !$canCache ) {
+                                       wfDebug( "Invalid cached redirect, touched $touched, epoch $wgCacheEpoch, cached $cacheTime\n" );
+                               } else {
+                                       wfDebug( "Key expired, touched $touched, epoch $wgCacheEpoch, cached $cacheTime\n" );
+                               }
                                $wgMemc->delete( $key );
                                $value = false;
                        }
@@ -40,6 +53,7 @@ class ParserCache
        
        function save( $parserOutput, &$article, &$user ){
                global $wgMemc;
+
                $key = $this->getKey( $article, $user );
                $now = wfTimestampNow();
                $parserOutput->setCacheTime( $now );