1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
<?php
/**
* Entry point for running maintenance scripts.
*
* @file
* @ingroup Maintenance
*/
use MediaWiki\Maintenance\MaintenanceRunner;
use MediaWiki\Settings\SettingsBuilder;
// No AutoLoader yet
require_once __DIR__ . '/Maintenance.php';
require_once __DIR__ . '/includes/MaintenanceRunner.php';
require_once __DIR__ . '/includes/MaintenanceParameters.php';
// Not in file scope, abort!
if ( !MaintenanceRunner::shouldExecute() ) {
return;
}
// Define the MediaWiki entrypoint
define( 'MEDIAWIKI', true );
$IP = wfDetectInstallPath();
require_once "$IP/includes/AutoLoader.php";
// phpcs:disable: MediaWiki.NamingConventions.ValidGlobalName.allowedPrefix
$runner = new MaintenanceRunner();
$runner->initFromWrapper( $argv );
$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 wfMaintenanceRunSetup( SettingsBuilder $settingsBuilder ) {
global $runner;
$runner->setup( $settingsBuilder );
}
define( 'MW_FINAL_SETUP_CALLBACK', 'wfMaintenanceRunSetup' );
}
// Initialize MediaWiki (load settings, extensions, etc).
require_once "$IP/includes/Setup.php";
$success = $runner->run();
// Exit with an error status if execute() returned false
if ( !$success ) {
exit( 1 );
}
|