4 * Entry point for running maintenance scripts.
10 use MediaWiki\Maintenance\MaintenanceRunner
;
11 use MediaWiki\Settings\SettingsBuilder
;
14 require_once __DIR__
. '/Maintenance.php';
15 require_once __DIR__
. '/includes/MaintenanceRunner.php';
16 require_once __DIR__
. '/includes/MaintenanceParameters.php';
18 // Not in file scope, abort!
19 if ( !MaintenanceRunner
::shouldExecute() ) {
23 // Define the MediaWiki entrypoint
24 define( 'MEDIAWIKI', true );
26 $IP = wfDetectInstallPath();
27 require_once "$IP/includes/AutoLoader.php";
29 // phpcs:disable: MediaWiki.NamingConventions.ValidGlobalName.allowedPrefix
30 $runner = new MaintenanceRunner();
31 $runner->initFromWrapper( $argv );
33 $runner->defineSettings();
35 // Custom setup for Maintenance entry point
36 if ( !defined( 'MW_FINAL_SETUP_CALLBACK' ) ) {
38 // Define a function, since we can't put a closure or object
39 // reference into MW_FINAL_SETUP_CALLBACK.
40 function wfMaintenanceRunSetup( SettingsBuilder
$settingsBuilder ) {
42 $runner->setup( $settingsBuilder );
45 define( 'MW_FINAL_SETUP_CALLBACK', 'wfMaintenanceRunSetup' );
48 // Initialize MediaWiki (load settings, extensions, etc).
49 require_once "$IP/includes/Setup.php";
51 $success = $runner->run();
53 // Exit with an error status if execute() returned false