From 949a2ecb3b66c35a27e37794d51c6dccbbdf5f68 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Wed, 10 Aug 2011 17:28:25 +0000 Subject: [PATCH] (bug 30219) NoLocalSettings.php broken on Windows servers. Per Tim on r70711, can't use pathinfo() on url's since the slashes don't match. --- includes/templates/NoLocalSettings.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/includes/templates/NoLocalSettings.php b/includes/templates/NoLocalSettings.php index 9001e3ba8e..facb616779 100644 --- a/includes/templates/NoLocalSettings.php +++ b/includes/templates/NoLocalSettings.php @@ -9,10 +9,17 @@ if ( !isset( $wgVersion ) ) { $wgVersion = 'VERSION'; } -$script = $_SERVER['SCRIPT_NAME']; -$path = pathinfo( $script, PATHINFO_DIRNAME ) . '/'; -$path = str_replace( '//', '/', $path ); -$ext = pathinfo( $script, PATHINFO_EXTENSION ); + +$matches = array(); +$ext = 'php'; +$path = '/'; +foreach( array_filter( explode( '/', $_SERVER['PHP_SELF'] ) ) as $part ) { + if( !preg_match( '/\.(php5?)$/', $part, $matches ) ) { + $path .= "$part/"; + } else { + $ext = $matches[1] == 'php5' ? 'php5' : 'php'; + } +} # Check to see if the installer is running if ( !function_exists( 'session_name' ) ) { -- 2.20.1