MediaWiki REL1_39
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}
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...
if(!defined( 'MW_NO_SESSION') &&! $wgCommandLineMode $wgLang
Definition Setup.php:497
static getWebInstaller(WebRequest $request)
Instantiates and returns an instance of WebInstaller or its descendant classes.
Service locator for MediaWiki core services.
$wgCanonicalNamespaceNames
Config variable stub for the CanonicalNamespaceNames setting, for use by phpdoc and IDEs.
$wgMetaNamespace
Config variable stub for the MetaNamespace setting, for use by phpdoc and IDEs.
wfInstallerMain()
Definition index.php:42