From b9b85843572bf283f48285001e276ba7e61b63f6 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 22 Feb 2009 13:37:51 +0100 Subject: updated to MediaWiki 1.14.0 --- index.php | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index 4cadf788..1c24f5a5 100644 --- a/index.php +++ b/index.php @@ -47,10 +47,8 @@ wfProfileIn( 'main-misc-setup' ); OutputPage::setEncodings(); # Not really used yet $maxLag = $wgRequest->getVal( 'maxlag' ); -if ( !is_null( $maxLag ) ) { - if ( !$mediaWiki->checkMaxLag( $maxLag ) ) { - exit; - } +if( !is_null($maxLag) && !$mediaWiki->checkMaxLag( $maxLag ) ) { + exit; } # Query string fields @@ -58,7 +56,7 @@ $action = $wgRequest->getVal( 'action', 'view' ); $title = $wgRequest->getVal( 'title' ); $wgTitle = $mediaWiki->checkInitialQueries( $title, $action ); -if ($wgTitle == NULL) { +if( $wgTitle === NULL ) { unset( $wgTitle ); } @@ -67,15 +65,38 @@ wfProfileOut( 'main-misc-setup' ); # # Send Ajax requests to the Ajax dispatcher. # -if ( $wgUseAjax && $action == 'ajax' ) { +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' ); + // Raw pages should handle cache control on their own, + // even when using file cache. This reduces hits from clients. + if( $action != 'raw' && HTMLFileCache::useFileCache() ) { + /* Try low-level file cache hit */ + $cache = new HTMLFileCache( $wgTitle, $action ); + 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 = MediaWiki::articleFromTitle( $wgTitle ); + $wgArticle->viewUpdates(); + # Tell $wgOut that output is taken care of + wfProfileOut( 'main-try-filecache' ); + $mediaWiki->restInPeace(); + exit; + } + } + wfProfileOut( 'main-try-filecache' ); +} + # Setting global variables in mediaWiki $mediaWiki->setVal( 'action', $action ); $mediaWiki->setVal( 'CommandLineMode', $wgCommandLineMode ); @@ -91,7 +112,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 ); -- cgit v1.2.2