View Issue Details

This bug affects 1 person(s).
 8
IDProjectCategoryView StatusLast Update
10417Bug reportsInstallationpublic2016-02-16 00:36
Reporterollehar Assigned ToDenisChenu  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version2.50.x 
Target Version2.50.xFixed in Version2.50.x 
Summary10417: Installer does not create new database when it should
Description

Installer does not create new database when it should

Steps To Reproduce

In installer and db settings, write a name of a db that doesn't exist yet. It should be created, but instead there is an error.

TagsNo tags attached.
Attached Files
Bug heat8
Complete LimeSurvey version number (& build)latest
I will donate to the project if issue is resolvedNo
Browser
Database type & version-
Server OS (if known)-
Webserver software & version (if known)-
PHP Version-

Users monitoring this issue

There are no users monitoring this issue.

Activities

DenisChenu

DenisChenu

2016-02-13 14:25

developer   ~35092

Using $e->getCode()!=1049 and update stepDatabaseConfiguration

dbTest :

  • throw error if DB connection can not be done
  • return (bool)db exist

You're sure for code ? It work for

  • User have 'global' permission for this dn name + db don't exist : return false
  • User don't have 'global' permission for this dn name + db don't exist : throw error
    with mysql. Not tested with another DB
ollehar

ollehar

2016-02-15 10:45

administrator   ~35111

Works for MySQL but not Postgres.

ollehar

ollehar

2016-02-15 10:53

administrator   ~35112

Maybe partly my fault. The exception code 1049 for "Database not found" exception only works for MySQL.

ollehar

ollehar

2016-02-15 10:55

administrator   ~35113

Last edited: 2016-02-15 10:55

Maybe this could help?

http://stackoverflow.com/questions/15177652/pdo-check-if-database-exists

Not sure which databases it works for, though.

DenisChenu

DenisChenu

2016-02-15 11:01

developer   ~35115

Last edited: 2016-02-15 11:02

OK, it's what i think this part ois DB specific

1st solution then must do it in 2 part :

  • Try a SQL connect with DB
  • If not : try SQL connect without DB : if OK : return false, if not : return true
    We are unsure This user have the right to create DB

2nd solution : find the correct SQLSTATE error returned , no driver dependant (or find the 3 errorCode() for mysql/pgsql and mssql)

PS: http://docstore.mik.ua/orelly/java-ent/jenut/ch08_06.htm ?

DenisChenu

DenisChenu

2016-02-15 13:46

developer   ~35138

@olle : can you validate if LS is able to create table https://raw.githubusercontent.com/LimeSurvey/LimeSurvey/3ff4864c0c5d32016fb1f7f8bead380856a66571/application/controllers/InstallerController.php (previous file) with pgsql ?

Seems return 7 : OK
But connect without "database' aren't accepted ?

I just try with a user who have all rights on my system : with old system retunr "invalid connexion"

ollehar

ollehar

2016-02-15 13:52

administrator   ~35139

Will do.

ollehar

ollehar

2016-02-15 13:54

administrator   ~35140

Uploaded screenshot with my error.

DenisChenu

DenisChenu

2016-02-15 15:01

developer   ~35144

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=17399

DenisChenu

DenisChenu

2016-02-15 15:13

developer   ~35145

I'm unsure if we can send the error if DB not exist and myusql/pgsql.

Actaulllly right on DB are not completely done.

I make some other try (to send user access to this DB error specifc)

LouisGac

LouisGac

2016-02-15 18:00

developer   ~35156

I'm not so sure that we should let the installer to create a DB. It implies to push people to use a db user with a strong level of permissions... which is a bad security behaviour... does other Web app like joomla or spip installers can create databases ?

DenisChenu

DenisChenu

2016-02-15 18:32

developer   ~35165

Last edited: 2016-02-15 18:33

Yes,

I have a specific user with sp_% rights only in mysql.
for pgsql : in general : i create the DB before.

I really think to udate the system again, but more simple and try to send maximum information.

For example : if user don't have DB access : we don't have to try without dbname.

PS: DB creation is done since LS exist.

c_schmitz

c_schmitz

2016-02-16 00:36

administrator   ~35178

2.50+ Build 160215 released

Related Changesets

LimeSurvey: master 7dcc37ce

2016-02-12 17:13:28

DenisChenu

Details Diff
Dev: Fixed issue : Try to create DB if not exist and connexion is OK
Dev: dbTest always return to model if connexion is not done
Dev: return true/false for dbexist
Affected Issues
10417
mod - application/controllers/InstallerController.php Diff File

LimeSurvey: master 8eb152c7

2016-02-15 14:00:52

DenisChenu

Details Diff
Fixed issue 10417: Installer does not create new database when it should
Dev: test is the error is "No DB" for mysql and pgsql
Dev: If not : use same system than before
Dev: Like old version, but more information
Affected Issues
10417
mod - application/controllers/InstallerController.php Diff File

Issue History

Date Modified Username Field Change
2016-02-12 15:29 ollehar New Issue
2016-02-12 15:29 ollehar Status new => assigned
2016-02-12 15:29 ollehar Assigned To => DenisChenu
2016-02-13 14:22 DenisChenu Changeset attached => LimeSurvey master 7dcc37ce
2016-02-13 14:25 DenisChenu Note Added: 35092
2016-02-13 14:26 DenisChenu Status assigned => resolved
2016-02-13 14:26 DenisChenu Fixed in Version => 2.5
2016-02-13 14:26 DenisChenu Resolution open => fixed
2016-02-15 10:45 ollehar Note Added: 35111
2016-02-15 10:45 ollehar Status resolved => assigned
2016-02-15 10:53 ollehar Note Added: 35112
2016-02-15 10:55 ollehar Note Added: 35113
2016-02-15 10:55 ollehar Note Edited: 35113
2016-02-15 11:01 DenisChenu Note Added: 35115
2016-02-15 11:02 DenisChenu Note Edited: 35115
2016-02-15 13:46 DenisChenu Note Added: 35138
2016-02-15 13:52 ollehar Note Added: 35139
2016-02-15 13:53 ollehar File Added: Screenshot from 2016-02-15 13:53:42.png
2016-02-15 13:54 ollehar Note Added: 35140
2016-02-15 15:01 DenisChenu Changeset attached => LimeSurvey master 8eb152c7
2016-02-15 15:01 DenisChenu Note Added: 35144
2016-02-15 15:13 DenisChenu Note Added: 35145
2016-02-15 15:13 DenisChenu Status assigned => resolved
2016-02-15 18:00 LouisGac Note Added: 35156
2016-02-15 18:32 DenisChenu Note Added: 35165
2016-02-15 18:33 DenisChenu Note Edited: 35165
2016-02-16 00:36 c_schmitz Note Added: 35178
2016-02-16 00:36 c_schmitz Status resolved => closed