From: Aaron Schulz Date: Sat, 27 Dec 2008 07:07:16 +0000 (+0000) Subject: * Move filecache hits to faster lower level index.php code X-Git-Tag: 1.31.0-rc.0~43755 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/password.php?a=commitdiff_plain;h=a7e6cd9d5d2b1f65a3ecb2825fc76774d2d60286;p=lhc%2Fweb%2Fwiklou.git * Move filecache hits to faster lower level index.php code * Disable outputpage after file cache hit, since output was streamed already. --- diff --git a/includes/Wiki.php b/includes/Wiki.php index 00fd407532..9bb54c3a11 100644 --- a/includes/Wiki.php +++ b/includes/Wiki.php @@ -111,7 +111,6 @@ class MediaWiki { // about the possible different language variants if( count( $wgContLang->getVariants() ) > 1 && !is_null( $ret ) && $ret->getArticleID() == 0 ) $wgContLang->findVariantLink( $title, $ret ); - } if( ( $oldid = $wgRequest->getInt( 'oldid' ) ) && ( is_null( $ret ) || $ret->getNamespace() != NS_SPECIAL ) ) { @@ -221,25 +220,6 @@ class MediaWiki { /* actions that need to be made when we have a special pages */ SpecialPage::executePath( $title ); } else { - /* Try low-level file cache hit */ - if( $title->getNamespace() != NS_MEDIAWIKI && HTMLFileCache::useFileCache() ) { - $cache = new HTMLFileCache( $title ); - if( $cache->isFileCacheGood( /* Assume up to date */ ) ) { - global $wgOut; - /* Check incoming headers to see if client has this cached */ - if( !$wgOut->checkLastModified( $cache->fileCacheTime() ) ) { - wfDebug( "MediaWiki::initializeSpecialCases(): about to load file cache\n" ); - $cache->loadFromFileCache(); - # Tell $wgOut that output is taken care of - $wgOut->disable(); - # Do any stats increment/watchlist stuff - $article = self::articleFromTitle( $title ); - $article->viewUpdates(); - } - wfProfileOut( __METHOD__ ); - return true; - } - } /* No match to special cases */ wfProfileOut( __METHOD__ ); return false; diff --git a/index.php b/index.php index 88585792f8..22e74e9e9c 100644 --- a/index.php +++ b/index.php @@ -67,13 +67,35 @@ wfProfileOut( 'main-misc-setup' ); # if( $wgUseAjax && $action == 'ajax' ) { require_once( $IP . '/includes/AjaxDispatcher.php' ); - $dispatcher = new AjaxDispatcher(); $dispatcher->performAction(); $mediaWiki->restInPeace(); exit; } +if( $wgUseFileCache && isset($wgTitle) ) { + wfProfileIn( 'main-try-filecache' ); + if( HTMLFileCache::useFileCache() ) { + /* Try low-level file cache hit */ + $cache = new HTMLFileCache( $wgTitle ); + if( $cache->isFileCacheGood( /* Assume up to date */ ) ) { + /* 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(); + } + # Tell $wgOut that output is taken care of + $wgOut->disable(); + wfProfileOut( 'main-try-filecache' ); + $mediaWiki->restInPeace(); + exit; + } + } + wfProfileOut( 'main-try-filecache' ); +} + # Setting global variables in mediaWiki $mediaWiki->setVal( 'action', $action ); $mediaWiki->setVal( 'CommandLineMode', $wgCommandLineMode ); @@ -89,7 +111,7 @@ $mediaWiki->setVal( 'UseExternalEditor', $wgUseExternalEditor ); $mediaWiki->setVal( 'UsePathInfo', $wgUsePathInfo ); $mediaWiki->initialize( $wgTitle, $wgArticle, $wgOut, $wgUser, $wgRequest ); -$mediaWiki->finalCleanup ( $wgDeferredUpdateList, $wgOut ); +$mediaWiki->finalCleanup( $wgDeferredUpdateList, $wgOut ); # Not sure when $wgPostCommitUpdateList gets set, so I keep this separate from finalCleanup $mediaWiki->doUpdates( $wgPostCommitUpdateList );