MediaWiki
REL1_24
|
00001 <?php 00029 if ( !defined( 'RUN_MAINTENANCE_IF_MAIN' ) ) { 00030 echo "This file must be included after Maintenance.php\n"; 00031 exit( 1 ); 00032 } 00033 00034 // Wasn't included from the file scope, halt execution (probably wanted the class) 00035 // If a class is using commandLine.inc (old school maintenance), they definitely 00036 // cannot be included and will proceed with execution 00037 if ( !Maintenance::shouldExecute() && $maintClass != 'CommandLineInc' ) { 00038 return; 00039 } 00040 00041 if ( !$maintClass || !class_exists( $maintClass ) ) { 00042 echo "\$maintClass is not set or is set to a non-existent class.\n"; 00043 exit( 1 ); 00044 } 00045 00046 // Get an object to start us off 00048 $maintenance = new $maintClass(); 00049 00050 // Basic sanity checks and such 00051 $maintenance->setup(); 00052 00053 // We used to call this variable $self, but it was moved 00054 // to $maintenance->mSelf. Keep that here for b/c 00055 $self = $maintenance->getName(); 00056 00057 # Start the autoloader, so that extensions can derive classes from core files 00058 require_once "$IP/includes/AutoLoader.php"; 00059 # Stub the profiler 00060 require_once "$IP/includes/profiler/Profiler.php"; 00061 00062 # Start the profiler 00063 $wgProfiler = array(); 00064 if ( file_exists( "$IP/StartProfiler.php" ) ) { 00065 require "$IP/StartProfiler.php"; 00066 } 00067 00068 // Some other requires 00069 require_once "$IP/includes/Defines.php"; 00070 require_once "$IP/includes/DefaultSettings.php"; 00071 00072 # Load composer's autoloader if present 00073 if ( is_readable( "$IP/vendor/autoload.php" ) ) { 00074 require_once "$IP/vendor/autoload.php"; 00075 } 00076 00077 if ( defined( 'MW_CONFIG_CALLBACK' ) ) { 00078 # Use a callback function to configure MediaWiki 00079 call_user_func( MW_CONFIG_CALLBACK ); 00080 } else { 00081 // Require the configuration (probably LocalSettings.php) 00082 require $maintenance->loadSettings(); 00083 } 00084 00085 if ( $maintenance->getDbType() === Maintenance::DB_NONE ) { 00086 if ( $wgLocalisationCacheConf['storeClass'] === false 00087 && ( $wgLocalisationCacheConf['store'] == 'db' 00088 || ( $wgLocalisationCacheConf['store'] == 'detect' && !$wgCacheDirectory ) ) 00089 ) { 00090 $wgLocalisationCacheConf['storeClass'] = 'LCStoreNull'; 00091 } 00092 } 00093 00094 $maintenance->setConfig( ConfigFactory::getDefaultInstance()->makeConfig( 'main' ) ); 00095 $maintenance->finalSetup(); 00096 // Some last includes 00097 require_once "$IP/includes/Setup.php"; 00098 00099 // Do the work 00100 try { 00101 $maintenance->execute(); 00102 00103 // Potentially debug globals 00104 $maintenance->globals(); 00105 00106 // Perform deferred updates. 00107 DeferredUpdates::doUpdates( 'commit' ); 00108 00109 // log profiling info 00110 wfLogProfilingData(); 00111 00112 // Commit and close up! 00113 $factory = wfGetLBFactory(); 00114 $factory->commitMasterChanges(); 00115 $factory->shutdown(); 00116 } catch ( MWException $mwe ) { 00117 echo $mwe->getText(); 00118 exit( 1 ); 00119 }