initForClass( $maintClass, $GLOBALS['argv'] ); // We used to call this variable $self, but it was moved // to $maintenance->mSelf. Keep that here for b/c $self = $runner->getName(); $runner->defineSettings(); // Custom setup for Maintenance entry point if ( !defined( 'MW_FINAL_SETUP_CALLBACK' ) ) { // Define a function, since we can't put a closure or object // reference into MW_FINAL_SETUP_CALLBACK. function wfMaintenanceSetup( SettingsBuilder $settingsBuilder ) { global $runner; $runner->setup( $settingsBuilder ); } define( 'MW_FINAL_SETUP_CALLBACK', 'wfMaintenanceSetup' ); } // Initialize MediaWiki (load settings, initialized session, // enable MediaWikiServices) require_once "$IP/includes/Setup.php"; // We only get here if the script was invoked directly. // If it was loaded by MaintenanceRunner, MaintenanceRunner::shouldExecute() would have returned false, // and we would have returned from this file early. if ( stream_isatty( STDOUT ) ) { echo "\n"; echo "*******************************************************************************\n"; echo "NOTE: Do not run maintenance scripts directly, use maintenance/run.php instead!\n"; echo " Running scripts directly has been deprecated in MediaWiki 1.40.\n"; echo " It may not work for some (or any) scripts in the future.\n"; echo "*******************************************************************************\n"; echo "\n"; } // Do it! $success = $runner->run(); // Exit with an error status if execute() returned false if ( !$success ) { exit( 1 ); }