Fix for Bug #29628 - scriptpath Option of maintenance/install.php is ignored
[lhc/web/wiklou.git] / includes / installer / Installer.php
index 4fd9389..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' );
@@ -1003,12 +1004,12 @@ abstract class Installer {
                $c = hexdec($c);
                if ($c <= 0x7F) {
                        return chr($c);
-               } else if ($c <= 0x7FF) {
+               } elseif ($c <= 0x7FF) {
                        return chr(0xC0 | $c >> 6) . chr(0x80 | $c & 0x3F);
-               } else if ($c <= 0xFFFF) {
+               } elseif ($c <= 0xFFFF) {
                        return chr(0xE0 | $c >> 12) . chr(0x80 | $c >> 6 & 0x3F)
                                . chr(0x80 | $c & 0x3F);
-               } else if ($c <= 0x10FFFF) {
+               } elseif ($c <= 0x10FFFF) {
                        return chr(0xF0 | $c >> 18) . chr(0x80 | $c >> 12 & 0x3F)
                                . chr(0x80 | $c >> 6 & 0x3F)
                                . chr(0x80 | $c & 0x3F);
@@ -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'] ) ?
@@ -1533,4 +1534,14 @@ abstract class Installer {
        public function addInstallStep( $callback, $findStep = 'BEGINNING' ) {
                $this->extraInstallSteps[$findStep][] = $callback;
        }
+
+       /**
+        * Disable the time limit for execution.
+        * Some long-running pages (Install, Upgrade) will want to do this
+        */
+       protected function disableTimeLimit() {
+               wfSuppressWarnings();
+               set_time_limit( 0 );
+               wfRestoreWarnings();
+       }
 }