summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2009-02-22 13:37:51 +0100
committerPierre Schmitz <pierre@archlinux.de>2009-02-22 13:37:51 +0100
commitb9b85843572bf283f48285001e276ba7e61b63f6 (patch)
tree4c6f4571552ada9ccfb4030481dcf77308f8b254 /index.php
parentd9a20acc4e789cca747ad360d87ee3f3e7aa58c1 (diff)
updated to MediaWiki 1.14.0
Diffstat (limited to 'index.php')
-rw-r--r--index.php37
1 files changed, 29 insertions, 8 deletions
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 );