| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
use MediaWiki\Html\TemplateParser; |
| 25 |
use Wikimedia\ObjectCache\EmptyBagOStuff; |
| 26 |
|
| 27 |
$matches = []; |
| 28 |
$path = '/'; |
| 29 |
foreach ( 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 |
|
| 38 |
if ( !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 |
|
| 50 |
$templateParser = new TemplateParser( null, new EmptyBagOStuff() ); |
| 51 |
|
| 52 |
|
| 53 |
try { |
| 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 |
} |