2004-02-28 03:04:02 +00:00
|
|
|
<?php
|
2006-01-13 17:33:37 +00:00
|
|
|
|
2007-03-12 15:57:17 +00:00
|
|
|
/**
|
|
|
|
|
* This is the main web entry point for MediaWiki.
|
|
|
|
|
*
|
|
|
|
|
* If you are reading this in your web browser, your server is probably
|
|
|
|
|
* not configured correctly to run PHP applications!
|
|
|
|
|
*
|
|
|
|
|
* See the README, INSTALL, and UPGRADE files for basic setup instructions
|
|
|
|
|
* and pointers to the online documentation.
|
|
|
|
|
*
|
|
|
|
|
* http://www.mediawiki.org/
|
|
|
|
|
*
|
|
|
|
|
* ----------
|
|
|
|
|
*
|
2010-01-01 21:09:14 +00:00
|
|
|
* Copyright (C) 2001-2010 Magnus Manske, Brion Vibber, Lee Daniel Crocker,
|
2007-03-12 15:57:17 +00:00
|
|
|
* Tim Starling, Erik Möller, Gabriel Wicke, Ævar Arnfjörð Bjarmason,
|
2008-07-20 14:29:04 +00:00
|
|
|
* Niklas Laxström, Domas Mituzas, Rob Church, Yuri Astrakhan, Aryeh Gregor,
|
|
|
|
|
* Aaron Schulz and others.
|
2007-03-12 15:57:17 +00:00
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
2009-03-20 12:00:38 +00:00
|
|
|
*
|
|
|
|
|
* @file
|
2007-03-12 15:57:17 +00:00
|
|
|
*/
|
|
|
|
|
|
2006-07-14 05:35:31 +00:00
|
|
|
# Initialise common code
|
2008-02-09 16:24:09 +00:00
|
|
|
$preIP = dirname( __FILE__ );
|
|
|
|
|
require_once( "$preIP/includes/WebStart.php" );
|
2006-01-13 12:10:59 +00:00
|
|
|
|
2006-01-13 17:33:37 +00:00
|
|
|
# Initialize MediaWiki base class
|
|
|
|
|
$mediaWiki = new MediaWiki();
|
2006-01-13 12:52:04 +00:00
|
|
|
|
2006-01-13 17:33:37 +00:00
|
|
|
wfProfileIn( 'main-misc-setup' );
|
2005-12-29 20:46:25 +00:00
|
|
|
|
2007-04-22 21:17:10 +00:00
|
|
|
$maxLag = $wgRequest->getVal( 'maxlag' );
|
2009-03-20 12:00:38 +00:00
|
|
|
if( !is_null( $maxLag ) && !$mediaWiki->checkMaxLag( $maxLag ) ) {
|
2008-12-09 23:00:28 +00:00
|
|
|
exit;
|
2007-04-22 21:17:10 +00:00
|
|
|
}
|
|
|
|
|
|
2006-01-13 17:33:37 +00:00
|
|
|
# Query string fields
|
|
|
|
|
$action = $wgRequest->getVal( 'action', 'view' );
|
|
|
|
|
$title = $wgRequest->getVal( 'title' );
|
2006-01-13 12:10:59 +00:00
|
|
|
|
2009-08-17 02:25:02 +00:00
|
|
|
# Set title from request parameters
|
2008-03-26 18:18:24 +00:00
|
|
|
$wgTitle = $mediaWiki->checkInitialQueries( $title, $action );
|
2007-01-09 21:00:14 +00:00
|
|
|
|
2008-04-29 16:35:11 +00:00
|
|
|
wfProfileOut( 'main-misc-setup' );
|
|
|
|
|
|
2006-03-27 18:53:15 +00:00
|
|
|
# Send Ajax requests to the Ajax dispatcher.
|
2008-12-09 23:00:28 +00:00
|
|
|
if( $wgUseAjax && $action == 'ajax' ) {
|
2010-08-13 21:39:51 +00:00
|
|
|
$dispatcher = new AjaxDispatcher();
|
2007-01-21 03:14:06 +00:00
|
|
|
$dispatcher->performAction();
|
2008-03-30 09:48:15 +00:00
|
|
|
$mediaWiki->restInPeace();
|
2007-01-21 03:14:06 +00:00
|
|
|
exit;
|
2006-03-27 18:53:15 +00:00
|
|
|
}
|
|
|
|
|
|
2010-12-07 12:35:14 +00:00
|
|
|
if( $wgUseFileCache && $wgTitle !== null ) {
|
2008-12-27 07:07:16 +00:00
|
|
|
wfProfileIn( 'main-try-filecache' );
|
2008-12-28 15:17:21 +00:00
|
|
|
// Raw pages should handle cache control on their own,
|
|
|
|
|
// even when using file cache. This reduces hits from clients.
|
2008-12-28 15:14:15 +00:00
|
|
|
if( $action != 'raw' && HTMLFileCache::useFileCache() ) {
|
2009-08-17 02:25:02 +00:00
|
|
|
/* 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();
|
2008-12-27 07:07:16 +00:00
|
|
|
}
|
2009-08-17 02:25:02 +00:00
|
|
|
# Do any stats increment/watchlist stuff
|
|
|
|
|
$wgArticle = MediaWiki::articleFromTitle( $wgTitle );
|
|
|
|
|
$wgArticle->viewUpdates();
|
2010-12-09 15:59:44 +00:00
|
|
|
# Tell $wgOut that output is taken care of
|
|
|
|
|
$wgOut->disable();
|
2009-08-17 02:25:02 +00:00
|
|
|
wfProfileOut( 'main-try-filecache' );
|
2010-12-09 15:59:44 +00:00
|
|
|
$mediaWiki->finalCleanup( $wgOut );
|
2009-08-17 02:25:02 +00:00
|
|
|
$mediaWiki->restInPeace();
|
|
|
|
|
exit;
|
2008-12-27 07:07:16 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
wfProfileOut( 'main-try-filecache' );
|
|
|
|
|
}
|
|
|
|
|
|
2006-01-11 15:46:01 +00:00
|
|
|
# Setting global variables in mediaWiki
|
2006-01-15 23:07:19 +00:00
|
|
|
$mediaWiki->setVal( 'action', $action );
|
|
|
|
|
$mediaWiki->setVal( 'DisabledActions', $wgDisabledActions );
|
2008-03-19 19:55:26 +00:00
|
|
|
$mediaWiki->setVal( 'DisableHardRedirects', $wgDisableHardRedirects );
|
|
|
|
|
$mediaWiki->setVal( 'EnableCreativeCommonsRdf', $wgEnableCreativeCommonsRdf );
|
|
|
|
|
$mediaWiki->setVal( 'EnableDublinCoreRdf', $wgEnableDublinCoreRdf );
|
|
|
|
|
$mediaWiki->setVal( 'Server', $wgServer );
|
|
|
|
|
$mediaWiki->setVal( 'SquidMaxage', $wgSquidMaxage );
|
|
|
|
|
$mediaWiki->setVal( 'UseExternalEditor', $wgUseExternalEditor );
|
|
|
|
|
$mediaWiki->setVal( 'UsePathInfo', $wgUsePathInfo );
|
2006-01-11 13:28:23 +00:00
|
|
|
|
2009-07-31 00:56:50 +00:00
|
|
|
$mediaWiki->performRequestForTitle( $wgTitle, $wgArticle, $wgOut, $wgUser, $wgRequest );
|
2010-12-07 11:49:13 +00:00
|
|
|
$mediaWiki->finalCleanup( $wgOut );
|
2008-03-19 19:55:26 +00:00
|
|
|
$mediaWiki->restInPeace();
|