From 0dd5d00e67ca11ca0112e2886b10f0621a3ab98f Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Sun, 28 Dec 2008 15:03:57 +0000 Subject: [PATCH] FileCache tweaks: * Fix typo self -> MediaWiki * View updates run on client cache hits * Removed unneeded $wgOut->disable() call * Disabled unused output on rawpage cache hits * Removed redundant checkLastModified() --- includes/HTMLFileCache.php | 1 + includes/RawPage.php | 6 ++---- index.php | 7 +++---- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/includes/HTMLFileCache.php b/includes/HTMLFileCache.php index 3f27d448ac..7eca7989e9 100644 --- a/includes/HTMLFileCache.php +++ b/includes/HTMLFileCache.php @@ -24,6 +24,7 @@ class HTMLFileCache { public function __construct( &$title, $type = 'view' ) { $this->mTitle = $title; + $type = $type ? $type : 'view'; $this->mType = ($type == 'raw' || $type == 'view' ) ? $type : false; $this->fileCacheName(); // init name } diff --git a/includes/RawPage.php b/includes/RawPage.php index a7bc02c14c..5d5c081e1a 100644 --- a/includes/RawPage.php +++ b/includes/RawPage.php @@ -153,10 +153,8 @@ class RawPage { if( HTMLFileCache::useFileCache() ) { $cache = new HTMLFileCache( $this->mTitle, 'raw' ); if( $cache->isFileCacheGood( /* Assume up to date */ ) ) { - /* Check incoming headers to see if client has this cached */ - if( !$wgOut->checkLastModified( $cache->fileCacheTime() ) ) { - $cache->loadFromFileCache(); - } + $cache->loadFromFileCache(); + $wgOut->disable(); return; } else { ob_start( array(&$cache, 'saveToFileCache' ) ); diff --git a/index.php b/index.php index 460c0ec8a3..141826478c 100644 --- a/index.php +++ b/index.php @@ -82,12 +82,11 @@ if( $wgUseFileCache && isset($wgTitle) ) { /* Check incoming headers to see if client has this cached */ if( !$wgOut->checkLastModified( $cache->fileCacheTime() ) ) { $cache->loadFromFileCache(); - # Do any stats increment/watchlist stuff - $wgArticle = self::articleFromTitle( $wgTitle ); - $wgArticle->viewUpdates(); } + # Do any stats increment/watchlist stuff + $wgArticle = MediaWiki::articleFromTitle( $wgTitle ); + $wgArticle->viewUpdates(); # Tell $wgOut that output is taken care of - $wgOut->disable(); wfProfileOut( 'main-try-filecache' ); $mediaWiki->restInPeace(); exit; -- 2.20.1