MediaWiki master
NoLocalSettings.php
Go to the documentation of this file.
1<?php
23# T32219 : can not use pathinfo() on URLs since slashes do not match
26
28$path = '/';
29foreach ( array_filter( explode( '/', $_SERVER['PHP_SELF'] ) ) as $part ) {
30 if ( !preg_match( '/\.(php)$/', $part, $matches ) ) {
31 $path .= "$part/";
32 } else {
33 break;
34 }
35}
36
37# Check to see if the installer is running
38if ( !function_exists( 'session_name' ) ) {
39 $installerStarted = false;
40} else {
41 if ( !wfIniGetBool( 'session.auto_start' ) ) {
42 session_name( 'mw_installer_session' );
43 }
44 $oldReporting = error_reporting( E_ALL & ~E_NOTICE );
45 $success = session_start();
46 error_reporting( $oldReporting );
47 $installerStarted = ( $success && isset( $_SESSION['installData'] ) );
48}
49
51
52# Render error page if no LocalSettings file can be found
53try {
54 echo $templateParser->processTemplate(
55 'NoLocalSettings',
56 [
57 'version' => ( defined( 'MW_VERSION' ) ? MW_VERSION : 'VERSION' ),
58 'path' => $path,
59 'localSettingsExists' => file_exists( MW_CONFIG_FILE ),
60 'installerStarted' => $installerStarted
61 ]
62 );
63} catch ( Exception $e ) {
64 echo 'Error: ' . htmlspecialchars( $e->getMessage() );
65}
const MW_VERSION
The running version of MediaWiki.
Definition Defines.php:37
wfIniGetBool( $setting)
Safety wrapper around ini_get() for boolean settings.
$templateParser
$installerStarted
No-op implementation that stores nothing.