MediaWiki
master
Maintenance.php
Go to the documentation of this file.
1
<?php
14
if
( !defined(
'RUN_MAINTENANCE_IF_MAIN'
) ) {
15
// Define this so scripts can easily find doMaintenance.php
16
define(
'RUN_MAINTENANCE_IF_MAIN'
, __DIR__ .
'/doMaintenance.php'
);
17
18
// Original name for compat, harmless
19
// Support: MediaWiki < 1.31
20
define(
'DO_MAINTENANCE'
, RUN_MAINTENANCE_IF_MAIN );
21
}
22
23
if
( defined(
'MEDIAWIKI'
) ) {
24
// This file is included by many autoloaded class files, and so may
25
// potentially be invoked in the context of a web request or another CLI
26
// script. It's not appropriate to run the following file-scope code in
27
// such a case.
28
return
;
29
}
30
31
// Abort if called from a web server
32
// wfIsCLI() is not available yet
33
if
( PHP_SAPI !==
'cli'
&& PHP_SAPI !==
'phpdbg'
) {
34
echo
"This script must be run from the command line\n"
;
35
exit( 1 );
36
}
37
38
define(
'MW_ENTRY_POINT'
,
'cli'
);
39
40
// Bail on old versions of PHP, or if composer has not been run yet to install
41
// dependencies.
42
require_once __DIR__ .
'/../includes/BootstrapHelperFunctions.php'
;
43
require_once __DIR__ .
'/../includes/PHPVersionCheck.php'
;
44
wfEntryPointCheck
(
'text'
);
45
50
$maintClass
=
false
;
51
52
// Some extensions rely on MW_INSTALL_PATH to find core files to include. Setting it here helps them
53
// if they're included by a core script (like DatabaseUpdater) after Maintenance.php has already
54
// been run.
55
if
( strval( getenv(
'MW_INSTALL_PATH'
) ) ===
''
) {
56
putenv(
'MW_INSTALL_PATH='
. realpath( __DIR__ .
'/..'
) );
57
}
58
59
require_once __DIR__ .
'/includes/Maintenance.php'
;
60
require_once __DIR__ .
'/includes/LoggedUpdateMaintenance.php'
;
61
require_once __DIR__ .
'/includes/FakeMaintenance.php'
;
wfEntryPointCheck
wfEntryPointCheck( $format='text', $scriptPath='/')
Check PHP version and that external dependencies are installed, and display an informative error if e...
Definition
PHPVersionCheck.php:337
$maintClass
$maintClass
Definition
addChangeTag.php:56
maintenance
Maintenance.php
Generated on Wed Jan 14 2026 09:27:09 for MediaWiki by
1.10.0