Catch excpt to avoid fatal in Message::__toString
[lhc/web/wiklou.git] / index.php
1 <?php
2 /**
3 * This is the main web entry point for MediaWiki.
4 *
5 * If you are reading this in your web browser, your server is probably
6 * not configured correctly to run PHP applications!
7 *
8 * See the README, INSTALL, and UPGRADE files for basic setup instructions
9 * and pointers to the online documentation.
10 *
11 * http://www.mediawiki.org/
12 *
13 * ----------
14 *
15 * Copyright (C) 2001-2011 Magnus Manske, Brion Vibber, Lee Daniel Crocker,
16 * Tim Starling, Erik Möller, Gabriel Wicke, Ævar Arnfjörð Bjarmason,
17 * Niklas Laxström, Domas Mituzas, Rob Church, Yuri Astrakhan, Aryeh Gregor,
18 * Aaron Schulz, Andrew Garrett, Raimond Spekking, Alexandre Emsenhuber
19 * Siebrand Mazeland, Chad Horohoe, Roan Kattouw and others.
20 *
21 * This program is free software; you can redistribute it and/or modify
22 * it under the terms of the GNU General Public License as published by
23 * the Free Software Foundation; either version 2 of the License, or
24 * (at your option) any later version.
25 *
26 * This program is distributed in the hope that it will be useful,
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 * GNU General Public License for more details.
30 *
31 * You should have received a copy of the GNU General Public License along
32 * with this program; if not, write to the Free Software Foundation, Inc.,
33 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
34 * http://www.gnu.org/copyleft/gpl.html
35 *
36 * @file
37 */
38
39 # Bail on old versions of PHP. Pretty much every other file in the codebase
40 # has structures (try/catch, foo()->bar(), etc etc) which throw parse errors in
41 # PHP 4. Setup.php and ObjectCache.php have structures invalid in PHP 5.0 and
42 # 5.1, respectively.
43 if ( !function_exists( 'version_compare' ) || version_compare( phpversion(), '5.3.2' ) < 0 ) {
44 // We need to use dirname( __FILE__ ) here cause __DIR__ is PHP5.3+
45 require( dirname( __FILE__ ) . '/includes/PHPVersionError.php' );
46 wfPHPVersionError( 'index.php' );
47 }
48
49 # Initialise common code. This gives us access to GlobalFunctions, the
50 # AutoLoader, and the globals $wgRequest, $wgOut, $wgUser, $wgLang and
51 # $wgContLang, amongst others; it does *not* load $wgTitle
52 if ( isset( $_SERVER['MW_COMPILED'] ) ) {
53 require ( 'phase3/includes/WebStart.php' );
54 } else {
55 require ( __DIR__ . '/includes/WebStart.php' );
56 }
57
58 $mediaWiki = new MediaWiki();
59 $mediaWiki->run();