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