Fix for Bug #29628 - scriptpath Option of maintenance/install.php is ignored
authorMark A. Hershberger <mah@users.mediawiki.org>
Fri, 1 Jul 2011 14:22:59 +0000 (14:22 +0000)
committerMark A. Hershberger <mah@users.mediawiki.org>
Fri, 1 Jul 2011 14:22:59 +0000 (14:22 +0000)
    The Script Path Option (--scriptpath) of maintenance/install.php
    is silently ignored if there is $_SERVER['SCRIPT_NAME'] set.

Apply patch from Tobias Müller.

CREDITS
includes/installer/Installer.php

diff --git a/CREDITS b/CREDITS
index 8bc7a26..d837fbc 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -148,6 +148,7 @@ following names for their contribution to the product.
 * Str4nd
 * svip
 * Tisane
+* Tobias Müller
 * Umherirrender
 * Ville Stadista
 * Vitaliy Filippov
index f9f59cd..dfc56e9 100644 (file)
@@ -860,12 +860,13 @@ abstract class 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
-               if ( !empty( $_SERVER['PHP_SELF'] ) ) {
+               if ( $this->getVar( 'wgScriptPath' ) ) {
+                       // Some kind soul has set it for us already (e.g. debconf)
+                       return true;
+               } elseif ( !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' );
@@ -1249,7 +1250,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'] ) ?