Merge "Improve sorting on SpecialWanted*-Pages"
[mediawiki.git] / mw-config / index.php
blobbe9debcb8d177f3891382114f724808b48f893a8
1 <?php
2 // @codingStandardsIgnoreFile Generic.Arrays.DisallowLongArraySyntax
3 /**
4 * New version of MediaWiki web-based config/installation
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.
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.
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
21 * @file
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 // @codingStandardsIgnoreStart MediaWiki.Usage.DirUsage.FunctionFound
27 require_once dirname( __FILE__ ) . '/../includes/PHPVersionCheck.php';
28 // @codingStandardsIgnoreEnd
29 wfEntryPointCheck( 'mw-config/index.php' );
31 define( 'MW_CONFIG_CALLBACK', 'Installer::overrideConfig' );
32 define( 'MEDIAWIKI_INSTALL', true );
34 // Resolve relative to regular MediaWiki root
35 // instead of mw-config subdirectory.
36 chdir( dirname( __DIR__ ) );
37 require dirname( __DIR__ ) . '/includes/WebStart.php';
39 wfInstallerMain();
41 function wfInstallerMain() {
42 global $wgRequest, $wgLang, $wgMetaNamespace, $wgCanonicalNamespaceNames;
44 $installer = InstallerOverrides::getWebInstaller( $wgRequest );
46 if ( !$installer->startSession() ) {
48 if ( $installer->request->getVal( "css" ) ) {
49 // Do not display errors on css pages
50 $installer->outputCss();
51 exit;
54 $errors = $installer->getPhpErrors();
55 $installer->showError( 'config-session-error', $errors[0] );
56 $installer->finish();
57 exit;
60 $fingerprint = $installer->getFingerprint();
61 if ( isset( $_SESSION['installData'][$fingerprint] ) ) {
62 $session = $_SESSION['installData'][$fingerprint];
63 } else {
64 $session = array();
67 if ( !is_null( $wgRequest->getVal( 'uselang' ) ) ) {
68 $langCode = $wgRequest->getVal( 'uselang' );
69 } elseif ( isset( $session['settings']['_UserLang'] ) ) {
70 $langCode = $session['settings']['_UserLang'];
71 } else {
72 $langCode = 'en';
74 $wgLang = Language::factory( $langCode );
75 RequestContext::getMain()->setLanguage( $wgLang );
77 $installer->setParserLanguage( $wgLang );
79 $wgMetaNamespace = $wgCanonicalNamespaceNames[NS_PROJECT];
81 $session = $installer->execute( $session );
83 $_SESSION['installData'][$fingerprint] = $session;