MediaWiki master
Maintenance.php
Go to the documentation of this file.
1<?php
8
13
15
16if ( !defined( 'RUN_MAINTENANCE_IF_MAIN' ) ) {
17 // Define this so scripts can easily find doMaintenance.php
18 define( 'RUN_MAINTENANCE_IF_MAIN', __DIR__ . '/doMaintenance.php' );
19
20 // Original name for compat, harmless
21 // Support: MediaWiki < 1.31
22 define( 'DO_MAINTENANCE', RUN_MAINTENANCE_IF_MAIN );
23}
24
25if ( defined( 'MEDIAWIKI' ) ) {
26 // This file is included by many autoloaded class files, and so may
27 // potentially be invoked in the context of a web request or another CLI
28 // script. It's not appropriate to run the following file-scope code in
29 // such a case.
30 return;
31}
32
33// Abort if called from a web server
34// wfIsCLI() is not available yet
35if ( PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg' ) {
36 echo "This script must be run from the command line\n";
37 exit( 1 );
38}
39
40define( 'MW_ENTRY_POINT', 'cli' );
41
42// Bail on old versions of PHP, or if composer has not been run yet to install
43// dependencies.
44require_once __DIR__ . '/../includes/PHPVersionCheck.php';
45( new PHPVersionCheck( 'text' ) )->run();
46
47// For compatibility require the bootstrap after version check
48require_once __DIR__ . '/../includes/BootstrapHelperFunctions.php';
49
55
56// Some extensions rely on MW_INSTALL_PATH to find core files to include. Setting it here helps them
57// if they're included by a core script (like DatabaseUpdater) after Maintenance.php has already
58// been run.
59if ( strval( getenv( 'MW_INSTALL_PATH' ) ) === '' ) {
60 putenv( 'MW_INSTALL_PATH=' . realpath( __DIR__ . '/..' ) );
61}
62
63require_once __DIR__ . '/includes/Maintenance.php';
64require_once __DIR__ . '/includes/LoggedUpdateMaintenance.php';
65require_once __DIR__ . '/includes/FakeMaintenance.php';
$maintClass
Check PHP Version, as well as for composer dependencies in entry points, and display something vaguel...