r93635 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93634‎ | r93635 | r93636 >
Date:18:03, 1 August 2011
Author:mah
Status:resolved (Comments)
Tags:
Comment:
Fixes Bug #30061 - Command line installer $wgScriptPath

Patch from Edward Z. Yang
Modified paths:
  • /trunk/phase3/CREDITS (modified) (history)
  • /trunk/phase3/includes/installer/Installer.php (modified) (history)
  • /trunk/phase3/includes/installer/WebInstaller.php (modified) (history)

Diff [purge]

Index: trunk/phase3/CREDITS
@@ -94,6 +94,7 @@
9595 * Dan Nessett
9696 * Daniel Arnold
9797 * Denny Vrandecic
 98+* Edward Z. Yang
9899 * Erwin Dokter
99100 * FunPika
100101 * Gero Scholz
Index: trunk/phase3/includes/installer/WebInstaller.php
@@ -1007,6 +1007,20 @@
10081008 }
10091009 }
10101010
 1011+ // PHP_SELF isn't available sometimes, such as when PHP is CGI but
 1012+ // cgi.fix_pathinfo is disabled. In that case, fall back to SCRIPT_NAME
 1013+ // to get the path to the current script... hopefully it's reliable. SIGH
 1014+ $path = false;
 1015+ if ( !empty( $_SERVER['PHP_SELF'] ) ) {
 1016+ $path = $_SERVER['PHP_SELF'];
 1017+ } elseif ( !empty( $_SERVER['SCRIPT_NAME'] ) ) {
 1018+ $path = $_SERVER['SCRIPT_NAME'];
 1019+ }
 1020+ if ($path !== false) {
 1021+ $uri = preg_replace( '{^(.*)/(mw-)?config.*$}', '$1', $path );
 1022+ $this->setVar( 'wgScriptPath', $uri );
 1023+ }
 1024+
10111025 return $newValues;
10121026 }
10131027
Index: trunk/phase3/includes/installer/Installer.php
@@ -857,26 +857,7 @@
858858 protected function envCheckPath() {
859859 global $IP;
860860 $IP = dirname( dirname( dirname( __FILE__ ) ) );
861 -
862861 $this->setVar( 'IP', $IP );
863 -
864 - // PHP_SELF isn't available sometimes, such as when PHP is CGI but
865 - // cgi.fix_pathinfo is disabled. In that case, fall back to SCRIPT_NAME
866 - // to get the path to the current script... hopefully it's reliable. SIGH
867 - if ( !empty( $_SERVER['PHP_SELF'] ) ) {
868 - $path = $_SERVER['PHP_SELF'];
869 - } elseif ( !empty( $_SERVER['SCRIPT_NAME'] ) ) {
870 - $path = $_SERVER['SCRIPT_NAME'];
871 - } elseif ( $this->getVar( 'wgScriptPath' ) ) {
872 - // Some kind soul has set it for us already (e.g. debconf)
873 - return true;
874 - } else {
875 - $this->showError( 'config-no-uri' );
876 - return false;
877 - }
878 -
879 - $uri = preg_replace( '{^(.*)/(mw-)?config.*$}', '$1', $path );
880 - $this->setVar( 'wgScriptPath', $uri );
881862 }
882863
883864 /**
@@ -1252,7 +1233,7 @@
12531234 require( "$IP/includes/DefaultSettings.php" );
12541235
12551236 foreach( $exts as $e ) {
1256 - require_once( "$IP/extensions/$e/$e.php" );
 1237+ require_once( "$IP/extensions/$e/$e.php" );
12571238 }
12581239
12591240 $hooksWeWant = isset( $wgHooks['LoadExtensionSchemaUpdates'] ) ?

Follow-up revisions

RevisionCommit summaryAuthorDate
r93828re: r93635...mah14:25, 3 August 2011
r93834* Make envCheckPath() specific to each installer, web vs cli...mah15:46, 3 August 2011

Comments

#Comment by 😂 (talk | contribs)   18:17, 1 August 2011

I understand the desire to fix the cli installer, but we keep damaging the web installer in the process :)

  • envCheckPath() doesn't really do anything useful anymore...it's design to sanity check that we've been able to determine the path
  • I'm not sure why the wgScriptPath check is now a part of setVarsFromRequest(), it seems out of place
#Comment by MarkAHershberger (talk | contribs)   14:22, 3 August 2011

> I'm not sure why the wgScriptPath check is now a part of setVarsFromRequest(), it seems out of place

Why? It is being set from information in the request, after all.

Status & tagging log