[ Index ] |
PHP Cross Reference of MediaWiki-1.24.0 |
[Summary view] [Print] [Text view]
1 <?php 2 /** 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 8 * 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. 13 * 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. 18 * 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 23 * 24 * @author Chad Horohoe <[email protected]> 25 * @file 26 * @ingroup Maintenance 27 */ 28 29 if ( !defined( 'RUN_MAINTENANCE_IF_MAIN' ) ) { 30 echo "This file must be included after Maintenance.php\n"; 31 exit( 1 ); 32 } 33 34 // Wasn't included from the file scope, halt execution (probably wanted the class) 35 // If a class is using commandLine.inc (old school maintenance), they definitely 36 // cannot be included and will proceed with execution 37 if ( !Maintenance::shouldExecute() && $maintClass != 'CommandLineInc' ) { 38 return; 39 } 40 41 if ( !$maintClass || !class_exists( $maintClass ) ) { 42 echo "\$maintClass is not set or is set to a non-existent class.\n"; 43 exit( 1 ); 44 } 45 46 // Get an object to start us off 47 /** @var Maintenance $maintenance */ 48 $maintenance = new $maintClass(); 49 50 // Basic sanity checks and such 51 $maintenance->setup(); 52 53 // We used to call this variable $self, but it was moved 54 // to $maintenance->mSelf. Keep that here for b/c 55 $self = $maintenance->getName(); 56 57 # Start the autoloader, so that extensions can derive classes from core files 58 require_once "$IP/includes/AutoLoader.php"; 59 # Stub the profiler 60 require_once "$IP/includes/profiler/Profiler.php"; 61 62 # Start the profiler 63 $wgProfiler = array(); 64 if ( file_exists( "$IP/StartProfiler.php" ) ) { 65 require "$IP/StartProfiler.php"; 66 } 67 68 // Some other requires 69 require_once "$IP/includes/Defines.php"; 70 require_once "$IP/includes/DefaultSettings.php"; 71 72 # Load composer's autoloader if present 73 if ( is_readable( "$IP/vendor/autoload.php" ) ) { 74 require_once "$IP/vendor/autoload.php"; 75 } 76 77 if ( defined( 'MW_CONFIG_CALLBACK' ) ) { 78 # Use a callback function to configure MediaWiki 79 call_user_func( MW_CONFIG_CALLBACK ); 80 } else { 81 // Require the configuration (probably LocalSettings.php) 82 require $maintenance->loadSettings(); 83 } 84 85 if ( $maintenance->getDbType() === Maintenance::DB_NONE ) { 86 if ( $wgLocalisationCacheConf['storeClass'] === false 87 && ( $wgLocalisationCacheConf['store'] == 'db' 88 || ( $wgLocalisationCacheConf['store'] == 'detect' && !$wgCacheDirectory ) ) 89 ) { 90 $wgLocalisationCacheConf['storeClass'] = 'LCStoreNull'; 91 } 92 } 93 94 $maintenance->setConfig( ConfigFactory::getDefaultInstance()->makeConfig( 'main' ) ); 95 $maintenance->finalSetup(); 96 // Some last includes 97 require_once "$IP/includes/Setup.php"; 98 99 // Do the work 100 try { 101 $maintenance->execute(); 102 103 // Potentially debug globals 104 $maintenance->globals(); 105 106 // Perform deferred updates. 107 DeferredUpdates::doUpdates( 'commit' ); 108 109 // log profiling info 110 wfLogProfilingData(); 111 112 // Commit and close up! 113 $factory = wfGetLBFactory(); 114 $factory->commitMasterChanges(); 115 $factory->shutdown(); 116 } catch ( MWException $mwe ) { 117 echo $mwe->getText(); 118 exit( 1 ); 119 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 14:03:12 2014 | Cross-referenced by PHPXref 0.7.1 |