Index: trunk/phase3/includes/Article.php |
— | — | @@ -2985,13 +2985,13 @@ |
2986 | 2986 | static $called = false; |
2987 | 2987 | if( $called ) { |
2988 | 2988 | wfDebug( "Article::tryFileCache(): called twice!?\n" ); |
2989 | | - return; |
| 2989 | + return false; |
2990 | 2990 | } |
2991 | 2991 | $called = true; |
2992 | | - if($this->isFileCacheable()) { |
| 2992 | + if( $this->isFileCacheable() ) { |
2993 | 2993 | $touched = $this->mTouched; |
2994 | 2994 | $cache = new HTMLFileCache( $this->mTitle ); |
2995 | | - if($cache->isFileCacheGood( $touched )) { |
| 2995 | + if( $cache->isFileCacheGood( $touched ) ) { |
2996 | 2996 | wfDebug( "Article::tryFileCache(): about to load file\n" ); |
2997 | 2997 | $cache->loadFromFileCache(); |
2998 | 2998 | return true; |
— | — | @@ -3002,6 +3002,7 @@ |
3003 | 3003 | } else { |
3004 | 3004 | wfDebug( "Article::tryFileCache(): not cacheable\n" ); |
3005 | 3005 | } |
| 3006 | + return false; |
3006 | 3007 | } |
3007 | 3008 | |
3008 | 3009 | /** |
— | — | @@ -3010,40 +3011,31 @@ |
3011 | 3012 | */ |
3012 | 3013 | function isFileCacheable() { |
3013 | 3014 | global $wgUser, $wgUseFileCache, $wgShowIPinHeader, $wgRequest, $wgLang, $wgContLang; |
3014 | | - $action = $wgRequest->getVal( 'action' ); |
3015 | | - $oldid = $wgRequest->getVal( 'oldid' ); |
3016 | | - $diff = $wgRequest->getVal( 'diff' ); |
3017 | | - $redirect = $wgRequest->getVal( 'redirect' ); |
3018 | | - $printable = $wgRequest->getVal( 'printable' ); |
3019 | | - $page = $wgRequest->getVal( 'page' ); |
3020 | | - $useskin = $wgRequest->getVal( 'useskin' ); |
| 3015 | + // Get all query values |
| 3016 | + $queryVals = $wgRequest->getValues(); |
| 3017 | + foreach( $queryVals as $query => $val ) { |
| 3018 | + if( $query == 'title' || ($query == 'action' && $val == 'view') ) { |
| 3019 | + // Normal page view in query form |
| 3020 | + } else { |
| 3021 | + return false; |
| 3022 | + } |
| 3023 | + } |
| 3024 | + // Check for non-standard user language; this covers uselang, |
| 3025 | + // and extensions for auto-detecting user language. |
| 3026 | + $ulang = $wgLang->getCode(); |
| 3027 | + $clang = $wgContLang->getCode(); |
3021 | 3028 | |
3022 | | - //check for non-standard user language; this covers uselang, |
3023 | | - //and extensions for auto-detecting user language. |
3024 | | - $ulang = $wgLang->getCode(); |
3025 | | - $clang = $wgContLang->getCode(); |
3026 | | - |
3027 | 3029 | $cacheable = $wgUseFileCache |
3028 | 3030 | && (!$wgShowIPinHeader) |
3029 | | - && ($this->getID() != 0) |
| 3031 | + && ($this->getID() > 0) |
3030 | 3032 | && ($wgUser->isAnon()) |
3031 | 3033 | && (!$wgUser->getNewtalk()) |
3032 | | - && ($this->mTitle->getNamespace() != NS_SPECIAL ) |
3033 | | - && (!isset($useskin)) |
3034 | | - && (empty( $action ) || $action == 'view') |
3035 | | - && (!isset($oldid)) |
3036 | | - && (!isset($diff)) |
3037 | | - && (!isset($redirect)) |
3038 | | - && (!isset($printable)) |
3039 | | - && !isset($page) |
3040 | 3034 | && (!$this->mRedirectedFrom) |
3041 | 3035 | && ($ulang === $clang); |
3042 | | - |
3043 | | - if ( $cacheable ) { |
3044 | | - //extension may have reason to disable file caching on some pages. |
| 3036 | + // Extension may have reason to disable file caching on some pages. |
| 3037 | + if( $cacheable ) { |
3045 | 3038 | $cacheable = wfRunHooks( 'IsFileCacheable', array( &$this ) ); |
3046 | 3039 | } |
3047 | | - |
3048 | 3040 | return $cacheable; |
3049 | 3041 | } |
3050 | 3042 | |
— | — | @@ -3473,7 +3465,7 @@ |
3474 | 3466 | * @param bool $cache |
3475 | 3467 | */ |
3476 | 3468 | public function outputWikiText( $text, $cache = true ) { |
3477 | | - global $wgParser, $wgUser, $wgOut, $wgEnableParserCache; |
| 3469 | + global $wgParser, $wgUser, $wgOut, $wgEnableParserCache, $wgUseFileCache; |
3478 | 3470 | |
3479 | 3471 | $popts = $wgOut->parserOptions(); |
3480 | 3472 | $popts->setTidy(true); |
— | — | @@ -3486,6 +3478,10 @@ |
3487 | 3479 | $parserCache = ParserCache::singleton(); |
3488 | 3480 | $parserCache->save( $parserOutput, $this, $wgUser ); |
3489 | 3481 | } |
| 3482 | + // Make sure file cache is not used on uncacheable content. |
| 3483 | + if( $wgUseFileCache && $parserOutput->getCacheTime() == -1 ) { |
| 3484 | + $wgUseFileCache = false; |
| 3485 | + } |
3490 | 3486 | |
3491 | 3487 | if ( !wfReadOnly() && $this->mTitle->areRestrictionsCascading() ) { |
3492 | 3488 | // templatelinks table may have become out of sync, |
Index: trunk/phase3/includes/HTMLFileCache.php |
— | — | @@ -119,8 +119,12 @@ |
120 | 120 | } |
121 | 121 | |
122 | 122 | function saveToFileCache( $origtext ) { |
| 123 | + global $wgUseFileCache; |
| 124 | + if( !$wgUseFileCache ) { |
| 125 | + return $origtext; // return to output |
| 126 | + } |
123 | 127 | $text = $origtext; |
124 | | - if(strcmp($text,'') == 0) return ''; |
| 128 | + if( strcmp($text,'') == 0 ) return ''; |
125 | 129 | |
126 | 130 | wfDebug(" saveToFileCache()\n", false); |
127 | 131 | |