Last modified: 2011-08-01 18:12:11 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T32061, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 30061 - Command line installer $wgScriptPath
Command line installer $wgScriptPath
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Installer (Other open bugs)
1.20.x
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch, patch-need-review
Depends on:
Blocks: 10542
  Show dependency treegraph
 
Reported: 2011-07-25 20:47 UTC by Platonides
Modified: 2011-08-01 18:12 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Fix (1.25 KB, patch)
2011-07-31 04:16 UTC, Edward Z. Yang
Details
Updated patch (tested too!) (1.90 KB, patch)
2011-07-31 04:54 UTC, Edward Z. Yang
Details

Description Platonides 2011-07-25 20:47:45 UTC
The command line installer sets:
$wgServer           = "http://localhost";
$wgScriptPath       = "install.php";

so trying to access the newly created wiki redirects you to http://localhostinstall.php
Comment 1 Brion Vibber 2011-07-28 23:46:32 UTC
Yeah, I can confirm that ain't pretty. I got:

$wgScriptPath       = "maintenance/install.php";

despite explicitly setting --scriptpath=/wiki on the command line.

On CLI you can't really guess the script path (if you look higher in the path you *might* be able to fake it by recognizing common paths like /var/www or /Library/Documents/WebServer or such, it's not likely to be reliable). It shouldn't be trying to derive the path, but even if it does by default the explicit setting should be taking priority!
Comment 2 Edward Z. Yang 2011-07-31 04:14:40 UTC
Would love to get this fixed. Here's a patch.

diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php
index 6da4f10..086458e 100644
--- a/includes/installer/Installer.php
+++ b/includes/installer/Installer.php
@@ -842,13 +842,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' );
                        return false;
Comment 3 Edward Z. Yang 2011-07-31 04:16:02 UTC
Created attachment 8853 [details]
Fix

Bah, linewrapping. Attached.
Comment 4 Chad H. 2011-07-31 04:17:42 UTC
Patch will not work and was already attempted, see r91726.
Comment 5 Edward Z. Yang 2011-07-31 04:42:41 UTC
WebInstaller should set scriptPath using SERVER globals itself (after all, it is irrelevant to the CliInstaller; what is it doing there anyway?) Then remove the checks from the base Installer.
Comment 6 Edward Z. Yang 2011-07-31 04:54:16 UTC
Created attachment 8854 [details]
Updated patch (tested too!)

New patch.
Comment 7 Mark A. Hershberger 2011-08-01 18:04:12 UTC
tested and applied: r93635

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links