2011-02-26 12:35:23 +00:00
|
|
|
<?php
|
2018-04-08 19:39:46 +00:00
|
|
|
// phpcs:disable Generic.Arrays.DisallowLongArraySyntax
|
2011-02-26 12:35:23 +00:00
|
|
|
/**
|
|
|
|
|
* New version of MediaWiki web-based config/installation
|
|
|
|
|
*
|
2012-10-02 20:24:33 +00:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
|
*
|
2011-02-26 12:35:23 +00:00
|
|
|
* @file
|
|
|
|
|
*/
|
|
|
|
|
|
2024-02-08 14:56:54 +00:00
|
|
|
use MediaWiki\Context\RequestContext;
|
2024-01-05 18:46:09 +00:00
|
|
|
use MediaWiki\Installer\Installer;
|
|
|
|
|
use MediaWiki\Installer\InstallerOverrides;
|
2019-08-26 12:24:37 +00:00
|
|
|
use MediaWiki\MediaWikiServices;
|
|
|
|
|
|
2015-04-18 09:37:10 +00:00
|
|
|
// Bail on old versions of PHP, or if composer has not been run yet to install
|
|
|
|
|
// dependencies. Using dirname( __FILE__ ) here because __DIR__ is PHP5.3+.
|
2018-01-01 13:10:16 +00:00
|
|
|
// phpcs:ignore MediaWiki.Usage.DirUsage.FunctionFound
|
2015-04-18 09:37:10 +00:00
|
|
|
require_once dirname( __FILE__ ) . '/../includes/PHPVersionCheck.php';
|
2020-02-07 17:54:55 +00:00
|
|
|
wfEntryPointCheck( 'html', dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) );
|
2014-07-07 10:48:11 +00:00
|
|
|
|
2024-01-05 18:46:09 +00:00
|
|
|
define( 'MW_CONFIG_CALLBACK', [ Installer::class, 'overrideConfig' ] );
|
2011-02-26 12:35:23 +00:00
|
|
|
define( 'MEDIAWIKI_INSTALL', true );
|
|
|
|
|
|
2013-02-15 07:31:48 +00:00
|
|
|
// Resolve relative to regular MediaWiki root
|
|
|
|
|
// instead of mw-config subdirectory.
|
2012-08-27 19:03:15 +00:00
|
|
|
chdir( dirname( __DIR__ ) );
|
2013-05-17 00:16:59 +00:00
|
|
|
require dirname( __DIR__ ) . '/includes/WebStart.php';
|
2011-02-26 12:35:23 +00:00
|
|
|
|
|
|
|
|
wfInstallerMain();
|
|
|
|
|
|
|
|
|
|
function wfInstallerMain() {
|
2019-03-09 13:29:03 +00:00
|
|
|
global $wgLang, $wgMetaNamespace, $wgCanonicalNamespaceNames;
|
|
|
|
|
$request = RequestContext::getMain()->getRequest();
|
2011-02-26 12:35:23 +00:00
|
|
|
|
2019-03-09 13:29:03 +00:00
|
|
|
$installer = InstallerOverrides::getWebInstaller( $request );
|
2011-02-26 12:35:23 +00:00
|
|
|
|
|
|
|
|
if ( !$installer->startSession() ) {
|
2024-05-13 09:03:13 +00:00
|
|
|
if ( $installer->request->getCheck( 'css' ) ) {
|
2014-05-04 10:43:28 +00:00
|
|
|
// Do not display errors on css pages
|
2014-06-27 19:03:37 +00:00
|
|
|
$installer->outputCss();
|
2014-05-04 10:43:28 +00:00
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$errors = $installer->getPhpErrors();
|
|
|
|
|
$installer->showError( 'config-session-error', $errors[0] );
|
2011-02-26 12:35:23 +00:00
|
|
|
$installer->finish();
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$fingerprint = $installer->getFingerprint();
|
|
|
|
|
if ( isset( $_SESSION['installData'][$fingerprint] ) ) {
|
|
|
|
|
$session = $_SESSION['installData'][$fingerprint];
|
|
|
|
|
} else {
|
2016-12-11 20:29:45 +00:00
|
|
|
$session = array();
|
2011-02-26 12:35:23 +00:00
|
|
|
}
|
|
|
|
|
|
2018-10-25 19:09:58 +00:00
|
|
|
$services = MediaWikiServices::getInstance();
|
|
|
|
|
$languageFactory = $services->getLanguageFactory();
|
|
|
|
|
$languageNameUtils = $services->getLanguageNameUtils();
|
|
|
|
|
|
|
|
|
|
$langCode = 'en';
|
|
|
|
|
if ( isset( $session['settings']['_UserLang'] ) &&
|
|
|
|
|
$languageNameUtils->isKnownLanguageTag( $session['settings']['_UserLang'] )
|
|
|
|
|
) {
|
2011-02-26 12:35:23 +00:00
|
|
|
$langCode = $session['settings']['_UserLang'];
|
|
|
|
|
}
|
2018-10-25 19:09:58 +00:00
|
|
|
$uselang = $request->getRawVal( 'uselang' );
|
|
|
|
|
if ( $uselang !== null && $languageNameUtils->isKnownLanguageTag( $uselang ) ) {
|
|
|
|
|
$langCode = $uselang;
|
|
|
|
|
}
|
|
|
|
|
$wgLang = $languageFactory->getRawLanguage( $langCode );
|
|
|
|
|
|
2016-02-10 10:32:38 +00:00
|
|
|
RequestContext::getMain()->setLanguage( $wgLang );
|
2011-02-26 12:35:23 +00:00
|
|
|
|
|
|
|
|
$installer->setParserLanguage( $wgLang );
|
|
|
|
|
|
|
|
|
|
$wgMetaNamespace = $wgCanonicalNamespaceNames[NS_PROJECT];
|
|
|
|
|
|
|
|
|
|
$session = $installer->execute( $session );
|
|
|
|
|
|
|
|
|
|
$_SESSION['installData'][$fingerprint] = $session;
|
|
|
|
|
}
|