]> scripts.mit.edu Git - autoinstalls/mediawiki.git/blob - index.php
MediaWiki 1.17.0
[autoinstalls/mediawiki.git] / index.php
1 <?php
2
3 /**
4  * This is the main web entry point for MediaWiki.
5  *
6  * If you are reading this in your web browser, your server is probably
7  * not configured correctly to run PHP applications!
8  *
9  * See the README, INSTALL, and UPGRADE files for basic setup instructions
10  * and pointers to the online documentation.
11  *
12  * http://www.mediawiki.org/
13  *
14  * ----------
15  *
16  * Copyright (C) 2001-2010 Magnus Manske, Brion Vibber, Lee Daniel Crocker,
17  * Tim Starling, Erik Möller, Gabriel Wicke, Ævar Arnfjörð Bjarmason,
18  * Niklas Laxström, Domas Mituzas, Rob Church, Yuri Astrakhan, Aryeh Gregor,
19  * Aaron Schulz, Andrew Garrett, Raimond Spekking, Alexandre Emsenhuber
20  * Siebrand Mazeland, Chad Horohoe, Roan Kattouw and others.
21  *
22  * This program is free software; you can redistribute it and/or modify
23  * it under the terms of the GNU General Public License as published by
24  * the Free Software Foundation; either version 2 of the License, or
25  * (at your option) any later version.
26  *
27  * This program is distributed in the hope that it will be useful,
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30  * GNU General Public License for more details.
31  *
32  * You should have received a copy of the GNU General Public License along
33  * with this program; if not, write to the Free Software Foundation, Inc.,
34  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
35  * http://www.gnu.org/copyleft/gpl.html
36  *
37  * @file
38  */
39
40 # Initialise common code
41 $preIP = dirname( __FILE__ );
42 require_once( "$preIP/includes/WebStart.php" );
43
44 # Initialize MediaWiki base class
45 $mediaWiki = new MediaWiki();
46
47 wfProfileIn( 'main-misc-setup' );
48 OutputPage::setEncodings(); # Not really used yet
49
50 $maxLag = $wgRequest->getVal( 'maxlag' );
51 if( !is_null( $maxLag ) && !$mediaWiki->checkMaxLag( $maxLag ) ) {
52         exit;
53 }
54
55 # Query string fields
56 $action = $wgRequest->getVal( 'action', 'view' );
57 $title = $wgRequest->getVal( 'title' );
58
59 # Set title from request parameters
60 $wgTitle = $mediaWiki->checkInitialQueries( $title, $action );
61 if( $wgTitle === null ) {
62         unset( $wgTitle );
63 }
64
65 wfProfileOut( 'main-misc-setup' );
66
67 #
68 # Send Ajax requests to the Ajax dispatcher.
69 #
70 if( $wgUseAjax && $action == 'ajax' ) {
71         require_once( $IP . '/includes/AjaxDispatcher.php' );
72         $dispatcher = new AjaxDispatcher();
73         $dispatcher->performAction();
74         $mediaWiki->restInPeace();
75         exit;
76 }
77
78 if( $wgUseFileCache && isset( $wgTitle ) ) {
79         wfProfileIn( 'main-try-filecache' );
80         // Raw pages should handle cache control on their own,
81         // even when using file cache. This reduces hits from clients.
82         if( $action != 'raw' && HTMLFileCache::useFileCache() ) {
83                 /* Try low-level file cache hit */
84                 $cache = new HTMLFileCache( $wgTitle, $action );
85                 if( $cache->isFileCacheGood( /* Assume up to date */ ) ) {
86                         /* Check incoming headers to see if client has this cached */
87                         if( !$wgOut->checkLastModified( $cache->fileCacheTime() ) ) {
88                                 $cache->loadFromFileCache();
89                         }
90                         # Do any stats increment/watchlist stuff
91                         $wgArticle = MediaWiki::articleFromTitle( $wgTitle );
92                         $wgArticle->viewUpdates();
93                         # Tell $wgOut that output is taken care of
94                         wfProfileOut( 'main-try-filecache' );
95                         $mediaWiki->restInPeace();
96                         exit;
97                 }
98         }
99         wfProfileOut( 'main-try-filecache' );
100 }
101
102 # Setting global variables in mediaWiki
103 $mediaWiki->setVal( 'action', $action );
104 $mediaWiki->setVal( 'DisabledActions', $wgDisabledActions );
105 $mediaWiki->setVal( 'DisableHardRedirects', $wgDisableHardRedirects );
106 $mediaWiki->setVal( 'EnableCreativeCommonsRdf', $wgEnableCreativeCommonsRdf );
107 $mediaWiki->setVal( 'EnableDublinCoreRdf', $wgEnableDublinCoreRdf );
108 $mediaWiki->setVal( 'JobRunRate', $wgJobRunRate );
109 $mediaWiki->setVal( 'Server', $wgServer );
110 $mediaWiki->setVal( 'SquidMaxage', $wgSquidMaxage );
111 $mediaWiki->setVal( 'UseExternalEditor', $wgUseExternalEditor );
112 $mediaWiki->setVal( 'UsePathInfo', $wgUsePathInfo );
113
114 $mediaWiki->performRequestForTitle( $wgTitle, $wgArticle, $wgOut, $wgUser, $wgRequest );
115 $mediaWiki->finalCleanup( $wgOut );
116
117 $mediaWiki->restInPeace();
118