MediaWiki REL1_37
index.php
Go to the documentation of this file.
1<?php
2// phpcs:disable Generic.Arrays.DisallowLongArraySyntax
25
26// Bail on old versions of PHP, or if composer has not been run yet to install
27// dependencies. Using dirname( __FILE__ ) here because __DIR__ is PHP5.3+.
28// phpcs:ignore MediaWiki.Usage.DirUsage.FunctionFound
29require_once dirname( __FILE__ ) . '/../includes/PHPVersionCheck.php';
30wfEntryPointCheck( 'html', dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) );
31
32define( 'MW_CONFIG_CALLBACK', 'Installer::overrideConfig' );
33define( 'MEDIAWIKI_INSTALL', true );
34
35// Resolve relative to regular MediaWiki root
36// instead of mw-config subdirectory.
37chdir( dirname( __DIR__ ) );
38require dirname( __DIR__ ) . '/includes/WebStart.php';
39
41
42function wfInstallerMain() {
44 $request = RequestContext::getMain()->getRequest();
45
46 $installer = InstallerOverrides::getWebInstaller( $request );
47
48 if ( !$installer->startSession() ) {
49 if ( $installer->request->getVal( 'css' ) ) {
50 // Do not display errors on css pages
51 $installer->outputCss();
52 exit;
53 }
54
55 $errors = $installer->getPhpErrors();
56 $installer->showError( 'config-session-error', $errors[0] );
57 $installer->finish();
58 exit;
59 }
60
61 $fingerprint = $installer->getFingerprint();
62 if ( isset( $_SESSION['installData'][$fingerprint] ) ) {
63 $session = $_SESSION['installData'][$fingerprint];
64 } else {
65 $session = array();
66 }
67
68 if ( $request->getCheck( 'uselang' ) ) {
69 $langCode = $request->getVal( 'uselang' );
70 } elseif ( isset( $session['settings']['_UserLang'] ) ) {
71 $langCode = $session['settings']['_UserLang'];
72 } else {
73 $langCode = 'en';
74 }
75 $wgLang = MediaWikiServices::getInstance()->getLanguageFactory()->getLanguage( $langCode );
76 RequestContext::getMain()->setLanguage( $wgLang );
77
78 $installer->setParserLanguage( $wgLang );
79
81
82 $session = $installer->execute( $session );
83
84 $_SESSION['installData'][$fingerprint] = $session;
85}
$wgCanonicalNamespaceNames
Canonical namespace names.
$wgMetaNamespace
Name of the project namespace.
const NS_PROJECT
Definition Defines.php:68
wfEntryPointCheck( $format='text', $scriptPath='/')
Check PHP version and that external dependencies are installed, and display an informative error if e...
$wgLang
Definition Setup.php:831
static getWebInstaller(WebRequest $request)
Instantiates and returns an instance of WebInstaller or its descendant classes.
MediaWikiServices is the service locator for the application scope of MediaWiki.
wfInstallerMain()
Definition index.php:42