Index: trunk/phase3/includes/HistoryPage.php |
— | — | @@ -64,16 +64,25 @@ |
65 | 65 | * @return nothing |
66 | 66 | */ |
67 | 67 | function history() { |
68 | | - global $wgOut, $wgRequest, $wgScript; |
| 68 | + global $wgOut, $wgRequest, $wgScript, $wgUseFileCache; |
69 | 69 | |
70 | 70 | /** |
71 | 71 | * Allow client caching. |
72 | 72 | */ |
73 | | - if ( $wgOut->checkLastModified( $this->article->getTouched() ) ) |
| 73 | + if ( $wgOut->checkLastModified( $this->article->getTouched() ) ) { |
74 | 74 | return; // Client cache fresh and headers sent, nothing more to do. |
| 75 | + } |
75 | 76 | |
76 | 77 | wfProfileIn( __METHOD__ ); |
77 | 78 | |
| 79 | + # Fill in the file cache if not set already |
| 80 | + if ( $wgUseFileCache && HTMLFileCache::useFileCache() ) { |
| 81 | + $cache = new HTMLFileCache( $this->title, 'history' ); |
| 82 | + if ( !$cache->isFileCacheGood( /* Assume up to date */ ) ) { |
| 83 | + ob_start( array( &$cache, 'saveToFileCache' ) ); |
| 84 | + } |
| 85 | + } |
| 86 | + |
78 | 87 | // Setup page variables. |
79 | 88 | $wgOut->setPageTitle( wfMsg( 'history-title', $this->title->getPrefixedText() ) ); |
80 | 89 | $wgOut->setPageTitleActionText( wfMsg( 'history_short' ) ); |
Index: trunk/phase3/includes/cache/HTMLFileCache.php |
— | — | @@ -29,10 +29,14 @@ |
30 | 30 | |
31 | 31 | public function __construct( $title, $type = 'view' ) { |
32 | 32 | $this->mTitle = $title; |
33 | | - $this->mType = ( $type == 'view' ) ? $type : false; |
| 33 | + $this->mType = in_array( $type, self::cacheableActions() ) ? $type : false; |
34 | 34 | $this->fileCacheName(); // init name |
35 | 35 | } |
36 | 36 | |
| 37 | + protected static function cacheableActions() { |
| 38 | + return array( 'view', 'history' ); |
| 39 | + } |
| 40 | + |
37 | 41 | public function fileCacheName() { |
38 | 42 | if( !$this->mFileCache ) { |
39 | 43 | global $wgCacheDirectory, $wgFileCacheDirectory, $wgFileCacheDepth; |
— | — | @@ -95,7 +99,7 @@ |
96 | 100 | continue; // note: curid sets title |
97 | 101 | // Normal page view in query form can have action=view. |
98 | 102 | // Raw hits for pages also stored, like .css pages for example. |
99 | | - } elseif( $query == 'action' && $val == 'view' ) { |
| 103 | + } elseif( $query == 'action' && in_array( $val, self::cacheableActions() ) ) { |
100 | 104 | continue; |
101 | 105 | // Below are header setting params |
102 | 106 | } elseif( $query == 'maxage' || $query == 'smaxage' ) { |
— | — | @@ -229,10 +233,10 @@ |
230 | 234 | } |
231 | 235 | |
232 | 236 | wfSuppressWarnings(); |
233 | | - |
234 | | - $fc = new self( $title, 'view' ); |
235 | | - unlink( $fc->fileCacheName() ); |
236 | | - |
| 237 | + foreach( self::cacheableActions() as $type ) { |
| 238 | + $fc = new self( $title, $type ); |
| 239 | + unlink( $fc->fileCacheName() ); |
| 240 | + } |
237 | 241 | wfRestoreWarnings(); |
238 | 242 | |
239 | 243 | return true; |