MediaWiki  1.34.0
NoLocalSettings.php
Go to the documentation of this file.
1 <?php
23 # T32219 : can not use pathinfo() on URLs since slashes do not match
24 $matches = [];
25 $path = '/';
26 foreach ( 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
35 if ( !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
50 try {
51  global $wgVersion;
52  echo $templateParser->processTemplate(
53  'NoLocalSettings',
54  [
55  '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
$wgVersion
MediaWiki version number.
Definition: DefaultSettings.php:75
$success
$success
Definition: NoLocalSettings.php:42
$installerStarted
$installerStarted
Definition: NoLocalSettings.php:44
$matches
$matches
Definition: NoLocalSettings.php:24
$templateParser
$templateParser
Definition: NoLocalSettings.php:47
wfIniGetBool
wfIniGetBool( $setting)
Safety wrapper around ini_get() for boolean settings.
Definition: GlobalFunctions.php:2062
$path
$path
Definition: NoLocalSettings.php:25