r45126 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45125‎ | r45126 | r45127 >
Date:15:03, 28 December 2008
Author:aaron
Status:ok
Tags:
Comment:
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()
Modified paths:
  • /trunk/phase3/includes/HTMLFileCache.php (modified) (history)
  • /trunk/phase3/includes/RawPage.php (modified) (history)
  • /trunk/phase3/index.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/RawPage.php
@@ -153,10 +153,8 @@
154154 if( HTMLFileCache::useFileCache() ) {
155155 $cache = new HTMLFileCache( $this->mTitle, 'raw' );
156156 if( $cache->isFileCacheGood( /* Assume up to date */ ) ) {
157 - /* Check incoming headers to see if client has this cached */
158 - if( !$wgOut->checkLastModified( $cache->fileCacheTime() ) ) {
159 - $cache->loadFromFileCache();
160 - }
 157+ $cache->loadFromFileCache();
 158+ $wgOut->disable();
161159 return;
162160 } else {
163161 ob_start( array(&$cache, 'saveToFileCache' ) );
Index: trunk/phase3/includes/HTMLFileCache.php
@@ -24,6 +24,7 @@
2525
2626 public function __construct( &$title, $type = 'view' ) {
2727 $this->mTitle = $title;
 28+ $type = $type ? $type : 'view';
2829 $this->mType = ($type == 'raw' || $type == 'view' ) ? $type : false;
2930 $this->fileCacheName(); // init name
3031 }
Index: trunk/phase3/index.php
@@ -82,12 +82,11 @@
8383 /* Check incoming headers to see if client has this cached */
8484 if( !$wgOut->checkLastModified( $cache->fileCacheTime() ) ) {
8585 $cache->loadFromFileCache();
86 - # Do any stats increment/watchlist stuff
87 - $wgArticle = self::articleFromTitle( $wgTitle );
88 - $wgArticle->viewUpdates();
8986 }
 87+ # Do any stats increment/watchlist stuff
 88+ $wgArticle = MediaWiki::articleFromTitle( $wgTitle );
 89+ $wgArticle->viewUpdates();
9090 # Tell $wgOut that output is taken care of
91 - $wgOut->disable();
9291 wfProfileOut( 'main-try-filecache' );
9392 $mediaWiki->restInPeace();
9493 exit;

Follow-up revisions

RevisionCommit summaryAuthorDate
r47139(bug 17420) Send the correct content type from action=raw when the HTML file ...tstarling15:07, 11 February 2009
r77975* Don't unset $wgTitle if it's null, just let it as is so that the variable i...ialex12:35, 7 December 2010

Status & tagging log