View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
05035 | Bug reports | Installation | public | 2011-03-16 02:05 | 2011-05-04 19:31 |
Reporter | Assigned To | c_schmitz | |||
Priority | normal | Severity | minor | ||
Status | closed | Resolution | fixed | ||
Fixed in Version | 1.91 | ||||
Summary | 05035: GSOC: main page reports generic database error if initial tables do not exist | ||||
Description | After initial setup and editing the config.php, if the user visits the root application page instead of the admin page, they see an unhelpful database error message. A careful installer would not fall into this trap but I was in a rush and instead spent a lot of time trying to sort out what was not a database connection problem at all. | ||||
Steps To Reproduce |
| ||||
Additional Information | The simple fix might be more detail in the error message to clue a new user in. More complex would be detection of the partially configured state taking some sensible action based on that (maybe redirect to admin page). | ||||
Tags | No tags attached. | ||||
Attached Files | cleared.patch (838 bytes)
--- C:\Users\3ncrypt3d\Desktop\bugs\index.php 2011-03-29 05:53:57.230468700 +0530 +++ C:\Users\3ncrypt3d\Desktop\bugs\index1.php 2011-03-29 05:01:53.149414000 +0530 @@ -395,7 +395,9 @@ AND ((a.expires >= '".date("Y-m-d H:i")."') OR (a.expires is null)) AND ((a.startdate <= '".date("Y-m-d H:i")."') OR (a.startdate is null)) ORDER BY surveyls_title"; - $result = db_execute_assoc($query,false,true) or die("Could not connect to database. If you try to install LimeSurvey please refer to the <a href='http://docs.limesurvey.org'>installation docs</a> and/or contact the system administrator of this webpage."); //Checked + if($result = db_execute_assoc($query,false,true)){} + else + header("Location:./admin/install");//Checked $list=array(); if($result->RecordCount() > 0) { modified.patch (775 bytes)
398c398 < $result = db_execute_assoc($query,false,true) or die("Could not connect to database. Trying to install Limesurvey? please refer to the <a href='http://docs.limesurvey.org'>installation docs</a> and/or contact the system administrator of this webpage."); //Checked --- > $result = db_execute_assoc($query,false,true) or die("Could not connect to database. If you are trying to install Limesurvey please refer to the <a href='http://docs.limesurvey.org/Installation&structure=English+Instructions+for+LimeSurvey#Run_the_installation_script'>installation docs</a>(in english) for this specific issue, for other languages check <a href='http://docs.limesurvey.org'>installation docs</a> and/or contact the system administrator of this webpage."); //Checked index.diff (851 bytes)
--- C:/Users/Admin/AppData/Local/Temp/index.php-revBASE.svn000.tmp.php Fri Apr 8 09:44:53 2011 +++ C:/wamp/www/LS-stable/index.php Fri Apr 8 09:40:55 2011 @@ -30,7 +30,16 @@ $move=sanitize_paranoid_string(returnglobal('move')); $clienttoken=sanitize_token(returnglobal('token')); +if (!$database_exists) +{ +die("Unable to connect to database.<br />If you are trying to install LimeSurvey please refer to the <a href='http://docs.limesurvey.org'>installation docs</a> and/or contact the system administrator of this webpage."); +} +if ($dbexistsbutempty) +{ +die("No tables in database.<br />If you are trying to install LimeSurvey please refer to the <a href='http://docs.limesurvey.org'>installation docs</a> and/or contact the system administrator of this webpage."); +} + if (!isset($thisstep)) { $thisstep = ""; 05035_dev.patch (1,374 bytes)
Index: common.php =================================================================== --- common.php (revision 9939) +++ common.php (working copy) @@ -143,6 +143,11 @@ $captchapath=$rooturl.'/'; } +//check if databasename is set in config file +if (!$databasename) +{ + die("Database Information not provided. If you try to install LimeSurvey please refer to the <a href='http://docs.limesurvey.org'>installation docs</a> and/or contact the system administrator of this webpage."); +} //BEFORE SESSIONCONTOL BECAUSE OF THE CONNECTION //CACHE DATA @@ -223,8 +228,13 @@ } -// Check if the DB is up to date -If ($dbexistsbutempty && $sourcefrom=='admin') { +//check if database exist and access is not via install script +if (!$database_exists && (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)) { 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."); } | ||||
Bug heat | 10 | ||||
Complete LimeSurvey version number (& build) | 9642 | ||||
I will donate to the project if issue is resolved | No | ||||
Browser | |||||
Database type & version | postgres 8.4 | ||||
Server OS (if known) | Debian Lenny | ||||
Webserver software & version (if known) | Apache2 | ||||
PHP Version | 5 | ||||
Can you test if this problem shows up with postgres only? I think is is no problem when using MySQL?! |
|
One of the paths I went down was switching to mysql to see if that made a difference and it didn't seem to. This is from memory though so I might be incorrect. I'll try to reproduce that when I get some time. |
|
Hi, I am very much interested in taking part in GSoC 2011 for limesurvey. This is my first contribution towards opensource. This patch takes care of the problem as far as i have checked. Let me know if there are any suggestions to improve it. Thanks. |
|
Carsten, can you please review the patch and give some feedback? Thanks for providing your patch, murarivivek. You can list this ticket as a reference at your application. |
|
The patch does not take care of the fact that the admin directory could be renamed (check config-defaults.php for the according setting). What should be changed is that there is an an error message that makes more sense in this particular case, maybe hints for the documentation without providing a direct link. |
|
So, does it mean making changes to the error message adding a better description and hints will do? |
|
Yes :-) |
|
changed the error message with better description for this specific issue. |
|
murarivivek, that patch is bogus and the error message is still wrong. You did not test what happens under certain conditions. You should test what the error message is under the following conditions:
and provide according error messages with hints to the documentation For example 'Could not connect to database.' is shown even though the database exists - which is obivously irritating. Also please provide a subversion patch instead (svn -diff) vs. the stable branch. Thank you! |
|
I'm also trying to complete a last-minute application for GSOC. I believe the attached patch will solve the problem, although perhaps a better long-term solution would be to address the issue in common.php where the database errors are shown in admin mode: Line 226: |
|
Thank you, magiclko. |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2011-03-16 02:05 |
|
New Issue | |
2011-03-21 00:45 | Mazi | Note Added: 14486 | |
2011-03-21 00:45 | Mazi | Assigned To | => c_schmitz |
2011-03-21 00:45 | Mazi | Status | new => feedback |
2011-03-21 00:52 |
|
Note Added: 14489 | |
2011-03-21 00:52 |
|
Status | feedback => assigned |
2011-03-26 17:50 | Mazi | Summary | main page reports generic database error if initial tables do not exist => GSOC: main page reports generic database error if initial tables do not exist |
2011-03-29 02:23 |
|
File Added: cleared.patch | |
2011-03-29 02:29 |
|
Note Added: 14591 | |
2011-03-29 02:29 |
|
Issue Monitored: user13064 | |
2011-03-29 13:48 | Mazi | Note Added: 14595 | |
2011-03-29 19:52 | c_schmitz | Note Added: 14605 | |
2011-03-30 02:00 |
|
Note Added: 14616 | |
2011-03-30 10:00 | c_schmitz | Note Added: 14617 | |
2011-03-30 17:04 |
|
File Added: modified.patch | |
2011-03-30 17:05 |
|
Note Added: 14620 | |
2011-04-04 13:39 | c_schmitz | Note Added: 14651 | |
2011-04-04 13:39 | c_schmitz | Status | assigned => feedback |
2011-04-08 17:50 |
|
File Added: index.diff | |
2011-04-08 17:53 |
|
Note Added: 14737 | |
2011-04-10 11:16 |
|
File Added: 05035_dev.patch | |
2011-04-11 14:10 | c_schmitz | Note Added: 14780 | |
2011-04-11 14:10 | c_schmitz | Status | feedback => resolved |
2011-04-11 14:10 | c_schmitz | Fixed in Version | => 1.91 |
2011-04-11 14:10 | c_schmitz | Resolution | open => fixed |
2011-05-04 19:31 | c_schmitz | Status | resolved => closed |