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