* @return nothing
*/
function history() {
- global $wgOut, $wgRequest, $wgScript;
+ global $wgOut, $wgRequest, $wgScript, $wgUseFileCache;
/**
* Allow client caching.
*/
- if ( $wgOut->checkLastModified( $this->article->getTouched() ) )
+ if ( $wgOut->checkLastModified( $this->article->getTouched() ) ) {
return; // Client cache fresh and headers sent, nothing more to do.
+ }
wfProfileIn( __METHOD__ );
+ # Fill in the file cache if not set already
+ if ( $wgUseFileCache && HTMLFileCache::useFileCache() ) {
+ $cache = new HTMLFileCache( $this->title, 'history' );
+ if ( !$cache->isFileCacheGood( /* Assume up to date */ ) ) {
+ ob_start( array( &$cache, 'saveToFileCache' ) );
+ }
+ }
+
// Setup page variables.
$wgOut->setPageTitle( wfMsg( 'history-title', $this->title->getPrefixedText() ) );
$wgOut->setPageTitleActionText( wfMsg( 'history_short' ) );
public function __construct( $title, $type = 'view' ) {
$this->mTitle = $title;
- $this->mType = ( $type == 'view' ) ? $type : false;
+ $this->mType = in_array( $type, self::cacheableActions() ) ? $type : false;
$this->fileCacheName(); // init name
}
+ protected static function cacheableActions() {
+ return array( 'view', 'history' );
+ }
+
public function fileCacheName() {
if( !$this->mFileCache ) {
global $wgCacheDirectory, $wgFileCacheDirectory, $wgFileCacheDepth;
continue; // note: curid sets title
// Normal page view in query form can have action=view.
// Raw hits for pages also stored, like .css pages for example.
- } elseif( $query == 'action' && $val == 'view' ) {
+ } elseif( $query == 'action' && in_array( $val, self::cacheableActions() ) ) {
continue;
// Below are header setting params
} elseif( $query == 'maxage' || $query == 'smaxage' ) {
}
wfSuppressWarnings();
-
- $fc = new self( $title, 'view' );
- unlink( $fc->fileCacheName() );
-
+ foreach( self::cacheableActions() as $type ) {
+ $fc = new self( $title, $type );
+ unlink( $fc->fileCacheName() );
+ }
wfRestoreWarnings();
return true;