Merge "rdbms: ignore inactive mysql GTIDs in replication position methods"
[lhc/web/wiklou.git] / mw-config / index.php
1 <?php
2 // phpcs:disable Generic.Arrays.DisallowLongArraySyntax
3 /**
4 * New version of MediaWiki web-based config/installation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 * http://www.gnu.org/copyleft/gpl.html
20 *
21 * @file
22 */
23
24 // Bail on old versions of PHP, or if composer has not been run yet to install
25 // dependencies. Using dirname( __FILE__ ) here because __DIR__ is PHP5.3+.
26 // phpcs:ignore MediaWiki.Usage.DirUsage.FunctionFound
27 require_once dirname( __FILE__ ) . '/../includes/PHPVersionCheck.php';
28 wfEntryPointCheck( 'mw-config/index.php' );
29
30 define( 'MW_CONFIG_CALLBACK', 'Installer::overrideConfig' );
31 define( 'MEDIAWIKI_INSTALL', true );
32
33 // Resolve relative to regular MediaWiki root
34 // instead of mw-config subdirectory.
35 chdir( dirname( __DIR__ ) );
36 require dirname( __DIR__ ) . '/includes/WebStart.php';
37
38 wfInstallerMain();
39
40 function wfInstallerMain() {
41 global $wgRequest, $wgLang, $wgMetaNamespace, $wgCanonicalNamespaceNames;
42
43 $installer = InstallerOverrides::getWebInstaller( $wgRequest );
44
45 if ( !$installer->startSession() ) {
46 if ( $installer->request->getVal( "css" ) ) {
47 // Do not display errors on css pages
48 $installer->outputCss();
49 exit;
50 }
51
52 $errors = $installer->getPhpErrors();
53 $installer->showError( 'config-session-error', $errors[0] );
54 $installer->finish();
55 exit;
56 }
57
58 $fingerprint = $installer->getFingerprint();
59 if ( isset( $_SESSION['installData'][$fingerprint] ) ) {
60 $session = $_SESSION['installData'][$fingerprint];
61 } else {
62 $session = array();
63 }
64
65 if ( !is_null( $wgRequest->getVal( 'uselang' ) ) ) {
66 $langCode = $wgRequest->getVal( 'uselang' );
67 } elseif ( isset( $session['settings']['_UserLang'] ) ) {
68 $langCode = $session['settings']['_UserLang'];
69 } else {
70 $langCode = 'en';
71 }
72 $wgLang = Language::factory( $langCode );
73 RequestContext::getMain()->setLanguage( $wgLang );
74
75 $installer->setParserLanguage( $wgLang );
76
77 $wgMetaNamespace = $wgCanonicalNamespaceNames[NS_PROJECT];
78
79 $session = $installer->execute( $session );
80
81 $_SESSION['installData'][$fingerprint] = $session;
82 }