FileCache tweaks:
authorAaron Schulz <aaron@users.mediawiki.org>
Sun, 28 Dec 2008 15:03:57 +0000 (15:03 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Sun, 28 Dec 2008 15:03:57 +0000 (15:03 +0000)
* 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
includes/RawPage.php
index.php

index 3f27d44..7eca798 100644 (file)
@@ -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
        }
index a7bc02c..5d5c081 100644 (file)
@@ -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' ) );
index 460c0ec..1418264 100644 (file)
--- 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;