Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 18
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2/**
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
17 *
18 * @file
19 * @ingroup Maintenance
20 * @defgroup Maintenance Maintenance
21 */
22
23/**
24 * @defgroup MaintenanceArchive Maintenance archives
25 * @ingroup Maintenance
26 */
27
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
60/**
61 * @var string|false $maintClass
62 * @phan-var class-string|false
63 */
64$maintClass = false;
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';