Revision: Remove some unnecessary temporary variables for returns
[mediawiki.git] / maintenance / Maintenance.php
blob6ec6fe0fee22e93f7b156ee5c75b5c8bb5614652
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.
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.
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
18 * @file
19 * @ingroup Maintenance
20 * @defgroup Maintenance Maintenance
23 if ( !defined( 'MW_ENTRY_POINT' ) ) {
24 define( 'MW_ENTRY_POINT', 'cli' );
27 // Bail on old versions of PHP, or if composer has not been run yet to install
28 // dependencies.
29 require_once __DIR__ . '/../includes/PHPVersionCheck.php';
30 wfEntryPointCheck( 'text' );
32 /**
33 * @defgroup MaintenanceArchive Maintenance archives
34 * @ingroup Maintenance
37 // Define this so scripts can easily find doMaintenance.php
38 define( 'RUN_MAINTENANCE_IF_MAIN', __DIR__ . '/doMaintenance.php' );
40 // Original name for compat, harmless
41 // Support: MediaWiki < 1.31
42 define( 'DO_MAINTENANCE', RUN_MAINTENANCE_IF_MAIN );
44 /**
45 * @var string|false
46 * @phan-var class-string|false
48 $maintClass = false;
50 // Some extensions rely on MW_INSTALL_PATH to find core files to include. Setting it here helps them
51 // if they're included by a core script (like DatabaseUpdater) after Maintenance.php has already
52 // been run.
53 if ( strval( getenv( 'MW_INSTALL_PATH' ) ) === '' ) {
54 putenv( 'MW_INSTALL_PATH=' . realpath( __DIR__ . '/..' ) );
57 require_once __DIR__ . '/includes/Maintenance.php';
58 require_once __DIR__ . '/includes/LoggedUpdateMaintenance.php';
59 require_once __DIR__ . '/includes/FakeMaintenance.php';