MediaWiki
1.39.10
doMaintenance.php
Go to the documentation of this file.
1
<?php
28
use
MediaWiki\Maintenance\MaintenanceRunner
;
29
use
MediaWiki\Settings\SettingsBuilder
;
30
31
// No AutoLoader yet
32
require_once __DIR__ .
'/includes/MaintenanceRunner.php'
;
33
require_once __DIR__ .
'/includes/MaintenanceParameters.php'
;
34
35
if
( !defined(
'RUN_MAINTENANCE_IF_MAIN'
) ) {
36
echo
"This file must be included after Maintenance.php\n"
;
37
exit( 1 );
38
}
39
40
// Wasn't included from the file scope, halt execution (probably wanted the class)
41
// If a class is using CommandLineInc (old school maintenance), they definitely
42
// cannot be included and will proceed with execution
43
// @phan-suppress-next-line PhanSuspiciousValueComparisonInGlobalScope
44
if
( !MaintenanceRunner::shouldExecute() &&
$maintClass
!= CommandLineInc::class ) {
45
return
;
46
}
47
48
// @phan-suppress-next-line PhanImpossibleConditionInGlobalScope
49
if
( !
$maintClass
|| !class_exists(
$maintClass
) ) {
50
echo
"\$maintClass is not set or is set to a non-existent class.\n"
;
51
exit( 1 );
52
}
53
54
// Define the MediaWiki entrypoint
55
define(
'MEDIAWIKI'
,
true
);
56
57
$IP
=
wfDetectInstallPath
();
58
59
$runner
=
new
MaintenanceRunner
();
60
$runner
->init(
$maintClass
);
61
62
// We used to call this variable $self, but it was moved
63
// to $maintenance->mSelf. Keep that here for b/c
64
$self
=
$runner
->getName();
65
66
$runner
->defineSettings();
67
68
// Custom setup for Maintenance entry point
69
if
( !defined(
'MW_SETUP_CALLBACK'
) ) {
70
71
// Define a function, since we can't put a closure or object
72
// reference into MW_SETUP_CALLBACK.
73
function
wfMaintenanceSetup(
SettingsBuilder
$settingsBuilder ) {
74
global
$runner
;
75
$runner
->overrideConfig( $settingsBuilder );
76
}
77
78
define(
'MW_SETUP_CALLBACK'
,
'wfMaintenanceSetup'
);
79
}
80
81
// Initialize MediaWiki (load settings, initialized session,
82
// enable MediaWikiServices)
83
require_once
"$IP/includes/Setup.php"
;
84
85
$success
=
$runner
->run();
86
87
// Exit with an error status if execute() returned false
88
if
( !
$success
) {
89
exit( 1 );
90
}
wfDetectInstallPath
wfDetectInstallPath()
Decide and remember where mediawiki is installed.
Definition
BootstrapHelperFunctions.php:68
$maintClass
$maintClass
Definition
addChangeTag.php:64
MediaWiki\Maintenance\MaintenanceRunner
A runner for maintenance scripts.
Definition
MaintenanceRunner.php:22
MediaWiki\Settings\SettingsBuilder
Utility for loading settings files.
Definition
SettingsBuilder.php:29
$IP
$IP
Definition
doMaintenance.php:57
$self
$self
Definition
doMaintenance.php:64
$runner
$runner
Definition
doMaintenance.php:59
$success
$success
Definition
doMaintenance.php:85
maintenance
doMaintenance.php
Generated on Tue Oct 1 2024 01:17:36 for MediaWiki by
1.10.0