3 * We want to make this whole thing as seamless as possible to the
4 * end-user. Unfortunately, we can't do _all_ of the work in the class
5 * because A) included files are not in global scope, but in the scope
6 * of their caller, and B) MediaWiki has way too many globals. So instead
7 * we'll kinda fake it, and do the requires() inline. <3 PHP
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 * http://www.gnu.org/copyleft/gpl.html
24 * @author Chad Horohoe <chad@anyonecanedit.org>
26 * @ingroup Maintenance
29 if ( !defined( 'DO_MAINTENANCE' ) ) {
30 echo "This file must be included after Maintenance.php\n";
34 error_reporting( E_ALL | E_STRICT
);
36 if( !$maintClass ||
!class_exists( $maintClass ) ) {
37 echo "\$maintClass is not set or is set to a non-existent class.";
41 if( defined( 'MW_NO_SETUP' ) ) {
45 // Get an object to start us off
46 $maintenance = new $maintClass();
48 // Basic sanity checks and such
49 $maintenance->setup();
51 // We used to call this variable $self, but it was moved
52 // to $maintenance->mSelf. Keep that here for b/c
53 $self = $maintenance->getName();
56 if ( file_exists( "$IP/StartProfiler.php" ) ) {
57 require_once( "$IP/StartProfiler.php" );
59 require_once( "$IP/includes/ProfilerStub.php" );
62 // Load settings, using wikimedia-mode if needed
63 if( file_exists( dirname(__FILE__
).'/wikimedia-mode' ) ) {
64 # TODO FIXME! Wikimedia-specific stuff needs to go away to an ext
69 require_once( "$IP/includes/AutoLoader.php" );
70 require_once( "$IP/includes/SiteConfiguration.php" );
71 require( "$IP/wgConf.php" );
72 $maintenance->loadWikimediaSettings();
73 require( $IP.'/includes/Defines.php' );
74 require( $IP.'/CommonSettings.php' );
76 require_once( "$IP/includes/AutoLoader.php" );
77 require_once( "$IP/includes/Defines.php" );
78 require_once( $maintenance->loadSettings() );
80 $maintenance->finalSetup();
82 require_once( "$IP/includes/Setup.php" );
83 require_once( "$IP/maintenance/install-utils.inc" );
85 // Much much faster startup than creating a title object
90 $maintenance->execute();
91 } catch( MWException
$mwe ) {
92 echo( $mwe->getText() );
95 // Potentially debug globals
96 $maintenance->globals();