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
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 
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
MediaWiki version number.
$success
$installerStarted
$templateParser
wfIniGetBool( $setting)
Safety wrapper around ini_get() for boolean settings.
$matches