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