Fixes Bug #30061 - Command line installer $wgScriptPath
authorMark A. Hershberger <mah@users.mediawiki.org>
Mon, 1 Aug 2011 18:03:06 +0000 (18:03 +0000)
committerMark A. Hershberger <mah@users.mediawiki.org>
Mon, 1 Aug 2011 18:03:06 +0000 (18:03 +0000)
Patch from Edward Z. Yang

CREDITS
includes/installer/Installer.php
includes/installer/WebInstaller.php

diff --git a/CREDITS b/CREDITS
index 50894b9..5ea87f8 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -94,6 +94,7 @@ following names for their contribution to the product.
 * Dan Nessett
 * Daniel Arnold
 * Denny Vrandecic
+* Edward Z. Yang
 * Erwin Dokter
 * FunPika
 * Gero Scholz
index 4467428..8615516 100644 (file)
@@ -857,26 +857,7 @@ abstract class Installer {
        protected function envCheckPath() {
                global $IP;
                $IP = dirname( dirname( dirname( __FILE__ ) ) );
-
                $this->setVar( 'IP', $IP );
-
-               // PHP_SELF isn't available sometimes, such as when PHP is CGI but
-               // cgi.fix_pathinfo is disabled. In that case, fall back to SCRIPT_NAME
-               // to get the path to the current script... hopefully it's reliable. SIGH
-               if ( !empty( $_SERVER['PHP_SELF'] ) ) {
-                       $path = $_SERVER['PHP_SELF'];
-               } elseif ( !empty( $_SERVER['SCRIPT_NAME'] ) ) {
-                       $path = $_SERVER['SCRIPT_NAME'];
-               } elseif ( $this->getVar( 'wgScriptPath' ) ) {
-                       // Some kind soul has set it for us already (e.g. debconf)
-                       return true;
-               } else {
-                       $this->showError( 'config-no-uri' );
-                       return false;
-               }
-
-               $uri = preg_replace( '{^(.*)/(mw-)?config.*$}', '$1', $path );
-               $this->setVar( 'wgScriptPath', $uri );
        }
 
        /**
@@ -1252,7 +1233,7 @@ abstract class Installer {
                require( "$IP/includes/DefaultSettings.php" );
 
                foreach( $exts as $e ) {
-                       require_once( "$IP/extensions/$e/$e.php" );
+                       require_once( "$IP/extensions/$e/$e.php" );
                }
 
                $hooksWeWant = isset( $wgHooks['LoadExtensionSchemaUpdates'] ) ?
index 4189ece..9b6c7da 100644 (file)
@@ -1007,6 +1007,20 @@ class WebInstaller extends Installer {
                        }
                }
 
+               // PHP_SELF isn't available sometimes, such as when PHP is CGI but
+               // cgi.fix_pathinfo is disabled. In that case, fall back to SCRIPT_NAME
+               // to get the path to the current script... hopefully it's reliable. SIGH
+               $path = false;
+               if ( !empty( $_SERVER['PHP_SELF'] ) ) {
+                       $path = $_SERVER['PHP_SELF'];
+               } elseif ( !empty( $_SERVER['SCRIPT_NAME'] ) ) {
+                       $path = $_SERVER['SCRIPT_NAME'];
+               }
+               if ($path !== false) {
+                       $uri = preg_replace( '{^(.*)/(mw-)?config.*$}', '$1', $path );
+                       $this->setVar( 'wgScriptPath', $uri );
+               }
+
                return $newValues;
        }