Was it supposed to be a comma instead of dot? :)
[lhc/web/wiklou.git] / maintenance / doMaintenance.php
index c5df5b9..f13ca07 100644 (file)
  * @ingroup Maintenance
  */
 
-error_reporting( E_ALL | E_STRICT );
+if ( !defined( 'DO_MAINTENANCE' ) ) {
+       echo "This file must be included after Maintenance.php\n";
+       exit( 1 );
+}
 
-if( !isset( $maintClass ) || !class_exists( $maintClass ) ) {
-       echo "\$maintClass is not set or is set to a non-existent class.";
-       die();
+if( !$maintClass || !class_exists( $maintClass ) ) {
+       echo "\$maintClass is not set or is set to a non-existent class.\n";
+       exit( 1 );
 }
 
 if( defined( 'MW_NO_SETUP' ) ) {
@@ -54,28 +57,29 @@ if ( file_exists( "$IP/StartProfiler.php" ) ) {
        require_once( "$IP/includes/ProfilerStub.php" );
 }
 
+// Some other requires
+require_once( "$IP/includes/AutoLoader.php" );
+require_once( "$IP/includes/Defines.php" );
+
 // Load settings, using wikimedia-mode if needed
-if( file_exists( dirname(__FILE__).'/wikimedia-mode' ) ) {
+// Fixme: replace this hack with general farm-friendly code
+if( file_exists( "$IP/wmf-config/wikimedia-mode" ) ) {
        # TODO FIXME! Wikimedia-specific stuff needs to go away to an ext
        # Maybe a hook?
        global $cluster;
        $wgWikiFarm = true;
-       $cluster = 'pmtma';
-       require_once( "$IP/includes/AutoLoader.php" );
+       $cluster = 'pmtpa';
        require_once( "$IP/includes/SiteConfiguration.php" );
-       require( "$IP/wgConf.php" );
+       require( "$IP/wmf-config/wgConf.php" );
        $maintenance->loadWikimediaSettings();
-       require( $IP.'/includes/Defines.php' );
-       require( $IP.'/CommonSettings.php' );
+       require( $IP.'/wmf-config/CommonSettings.php' );
 } else {
-       require_once( "$IP/includes/AutoLoader.php" );
-       require_once( "$IP/includes/Defines.php" );
        require_once( $maintenance->loadSettings() );
 }
 $maintenance->finalSetup();
 // Some last includes
 require_once( "$IP/includes/Setup.php" );
-require_once( "$IP/install-utils.inc" );
+require_once( "$IP/maintenance/install-utils.inc" );
 
 // Much much faster startup than creating a title object
 $wgTitle = null; 
@@ -83,9 +87,11 @@ $wgTitle = null;
 // Do the work
 try {
        $maintenance->execute();
+
+       // Potentially debug globals
+       $maintenance->globals();
 } catch( MWException $mwe ) {
        echo( $mwe->getText() );
+       exit( 1 );
 }
 
-// Potentially debug globals
-$maintenance->globals();