View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
05296 | Bug reports | Installation | public | 2011-06-21 23:04 | 2011-07-01 18:34 |
Reporter | Assigned To | c_schmitz | |||
Priority | normal | Severity | minor | ||
Status | closed | Resolution | fixed | ||
Product Version | 1.91+ | ||||
Fixed in Version | 1.91+ | ||||
Summary | 05296: admin/install/cmd_install.php no longer works | ||||
Description | I'm working on packaging LimeSurvey for Debian, and I've run into an issue with the cmd_install.php script. When it checks to see if the database exists, it checks $homeurl.'install' against $slashlesspath, and on the command-line $slashlesspath never has the 'install' portion that it checks for. The bug is on lines 234 & 240 of common.php and was introduced in revision 9991. http://limesurvey.svn.sourceforge.net/viewvc/limesurvey/source/limesurvey/common.php?r1=9990&r2=9991& | ||||
Steps To Reproduce | $ php /path/to/limesurvey/admin/install/cmd_install.php install <br />The LimeSurvey database does not exist. Please run the <a href='http://localhost/limesurvey/install/index.php'>install script</a> to create the necessary database. | ||||
Additional Information | I'd like to patch around it in Debian while waiting for 1.92 (or whenever it gets fixed upstream). I can think of three ways to do it, but I'd like some advice from the devs on which one to pursue: 1) I can add a check to compare $slashlesspath against $rootdir as well (which is what I think it's set to when we run from the command line 2) I can set a special "We're running from the command line" var in cmd_install.php before it loads common.php and check for it in common.php 3) I can check php_sapi_name() directly. (http://stackoverflow.com/questions/173851/what-is-the-canonical-way-to-determine-commandline-vs-http-execution-of-a-php-sc) I've indicated that I will donate to LimeSurvey if this is resolved in 24 hours, and what I mean is that if I get some advice on how best to patch this, I'll donate. Probably $10 or $20, I'll see what I have in my budget. I can write up the patch, apply it to Debian, then submit it to this bug report to be applied to newer versions of LimeSurvey. | ||||
Tags | No tags attached. | ||||
Attached Files | fix-cmd_install-in-1.91.diff (3,389 bytes)
Index: config-defaults.php =================================================================== --- config-defaults.php (revision 10330) +++ config-defaults.php (working copy) @@ -44,7 +44,13 @@ // FILE LOCATIONS -$rooturl = "http://{$_SERVER['HTTP_HOST']}/limesurvey"; //The root web url for your limesurvey installation. +// File Locations +if (isset($cmd_install) && $cmd_install) { + $rooturl = "http://localhost/limesurvey"; // A safe Root URL if we're doing a cmd_install +} else { + $rooturl = "http://{$_SERVER['HTTP_HOST']}/limesurvey"; // The root web url for your limesurvey installation (without a trailing slash). + // The double quotes (") are important. +} $rootdir = dirname(__FILE__); // This is the physical disk location for your limesurvey installation. Normally you don't have to touch this setting. // If you use IIS then you MUST enter the complete rootdir e.g. : $rootDir="C:\Inetpub\wwwroot\limesurvey"! Index: common.php =================================================================== --- common.php (revision 10330) +++ common.php (working copy) @@ -232,12 +232,12 @@ //check if database exist and access is not via install script -if (!$database_exists && (strcasecmp($slashlesspath,str_replace(array("\\", "/"), "", $homedir."install")) != 0)) { +if (!$database_exists && !$cmd_install && (strcasecmp($slashlesspath,str_replace(array("\\", "/"), "", $homedir."install")) != 0)) { die ("<br/>The LimeSurvey database does not exist. Please run the <a href='$homeurl/install/index.php'>install script</a> to create the necessary database."); } - // Check if the DB is up to date -if ($dbexistsbutempty && (strcasecmp($slashlesspath,str_replace(array("\\", "/"), "", $homedir."install")) != 0)) { + // Check if the DB is up to date and access is not via install script +if ($dbexistsbutempty && !$cmd_install && (strcasecmp($slashlesspath,str_replace(array("\\", "/"), "", $homedir."install")) != 0)) { die ("<br />The LimeSurvey database does exist but it seems to be empty. Please run the <a href='$homeurl/install/index.php'>install script</a> to create the necessary tables."); } Index: config.php =================================================================== --- config.php (revision 10330) +++ config.php (working copy) @@ -41,8 +41,12 @@ // a database with other applications. Suggested prefix is 'lime_' // File Locations -$rooturl = "http://{$_SERVER['HTTP_HOST']}/limesurvey"; // The root web url for your limesurvey installation (without a trailing slash). -// The double quotes (") are important. +if (isset($cmd_install) && $cmd_install) { + $rooturl = "http://localhost/limesurvey"; // A safe Root URL if we're doing a cmd_install +} else { + $rooturl = "http://{$_SERVER['HTTP_HOST']}/limesurvey"; // The root web url for your limesurvey installation (without a trailing slash). + // The double quotes (") are important. +} $rootdir = dirname(__FILE__); // This is the physical disk location for your limesurvey installation. Normally you don't have to touch this // setting. If you use IIS then you MUST enter the complete rootdir e.g. : $rootDir='C:\Inetpub\wwwroot\limesurvey'! | ||||
Bug heat | 4 | ||||
Complete LimeSurvey version number (& build) | 10315 | ||||
I will donate to the project if issue is resolved | Yes | ||||
Browser | |||||
Database type & version | Whatever comes with 10315 | ||||
Server OS (if known) | Linux | ||||
Webserver software & version (if known) | Apache 2 | ||||
PHP Version | 5.3 | ||||
Hello! I think solution #2 would be best and easiest (with proper commenting in common.php). No need to donate. Make sure the patch is created with subversion and based on the /limesurvey/source/limesurvey/ branch. Please attach it to this issue for review. Thank you! |
|
Patch attached. I've confirmed it works on my Debian package, and on a native install. But I've only tested the installation and one test survey. I'm assuming everything works as planned after that. |
|
Thank you. Fixed in rev. 10342 . |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2011-06-21 23:04 |
|
New Issue | |
2011-06-21 23:05 |
|
Issue Monitored: user14589 | |
2011-06-22 21:44 | c_schmitz | Note Added: 15557 | |
2011-06-22 21:44 | c_schmitz | Assigned To | => c_schmitz |
2011-06-22 21:44 | c_schmitz | Status | new => feedback |
2011-06-22 22:45 |
|
File Added: fix-cmd_install-in-1.91.diff | |
2011-06-22 22:45 |
|
Note Added: 15561 | |
2011-06-22 22:45 |
|
Status | feedback => assigned |
2011-06-23 21:57 | c_schmitz | Note Added: 15572 | |
2011-06-23 21:57 | c_schmitz | Status | assigned => resolved |
2011-06-23 21:57 | c_schmitz | Fixed in Version | => 1.91+ |
2011-06-23 21:57 | c_schmitz | Resolution | open => fixed |
2011-07-01 18:34 | c_schmitz | Status | resolved => closed |