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