MediaWiki master
NoLocalSettings.php
Go to the documentation of this file.
1<?php
8
9# T32219 : can not use pathinfo() on URLs since slashes do not match
12
13$scriptPath = dirname( $_SERVER['SCRIPT_NAME'] );
14$path = $scriptPath !== '/' ? rtrim( $scriptPath, '/' ) . '/' : '/';
15
16# Check to see if the installer is running
17if ( !function_exists( 'session_name' ) ) {
18 $installerStarted = false;
19} else {
20 if ( !wfIniGetBool( 'session.auto_start' ) ) {
21 session_name( 'mw_installer_session' );
22 }
23 $oldReporting = error_reporting( E_ALL & ~E_NOTICE );
24 $success = session_start();
25 error_reporting( $oldReporting );
26 $installerStarted = ( $success && isset( $_SESSION['installData'] ) );
27}
28
29$templateParser = new TemplateParser( null, new EmptyBagOStuff() );
30
31# Render error page if no LocalSettings file can be found
32try {
33 echo $templateParser->processTemplate(
34 'NoLocalSettings',
35 [
36 'version' => ( defined( 'MW_VERSION' ) ? MW_VERSION : 'VERSION' ),
37 'path' => $path,
38 'localSettingsExists' => file_exists( MW_CONFIG_FILE ),
39 'installerStarted' => $installerStarted
40 ]
41 );
42} catch ( Exception $e ) {
43 echo 'Error: ' . htmlspecialchars( $e->getMessage() );
44}
const MW_VERSION
The running version of MediaWiki.
Definition Defines.php:23
wfIniGetBool( $setting)
Safety wrapper around ini_get() for boolean settings.
$templateParser
$scriptPath
$installerStarted
Handles compiling Mustache templates into PHP rendering functions.
No-op implementation that stores nothing.