Describe the bug
When using the installer, if the mysql user has admin and write privileges, but not reading one, the installation is failing, but with a useless error message. We wasted hours before figuring out the actual issue.
To Reproduce
Steps to reproduce the behavior:
Current:
1: Cannot install language "English (English)"prod_20190415_installation.logERROR v1.7.5.1 2019/04/15 - 20:00:52: Cannot install language "English (English)"
Expected:
The mysql user cannot read the databaseAdditionnal information
PrestaShop version: 1.7.5.1
PHP version: 7.2.15
Hi @provirus,
Try to remove ./app/Resources/translations/en-US/en-US.zip and retry. Look like something goes wrong during download.
Thanks!
The issue is not about the download. The issue was that the database had no "SELECT" grants...
@provirus, could you try to install Prestashop in another host, check & feedback.
why? I don't understand. It looks like you want to troubleshoot what was already troubleshooted.
All that is needed is a fix in the error message. Most likely, there is an SQL exception that is catched (due to missing SELECT permission) and only an unrelated error is displayed.
Just granting SELECT was enough to fix and the installation is going thru. Nothing, but a code fix about the error message is needed now.
@khouloudbelguith This is rather a feature request than a bug as the root cause is diagnosed 馃槈
Not at all. A bug means the code is doing something wrong ; a feature request is asking for some feature that does not exist.
The bug here is that the error message has nothing to do with the installation problem. If the error were: "SQL error: cannot query the database" or "SQL error: cannot select" or anything else related to SQL, that would be fine. Currently, it is showing: "cannot install the language". That is so much unrelated that khouloudbelguith asked me to remove the language zip. That is proof that the error message is really bad. That is a bug; not a new feature.
It's really related to Khouloud's answer: in most cases, with this error message, her solution solves the problem. The error message describes the issue factually: there has been an error during the installation of the language.
In this case, the problem is about the bad configuration of MySQL. So, to solve this problem, a new in the installer must be developed, that would check before the installation the MySQL configuration and the user rights. This is a new feature.
If you want to add a new pre check, yes that is a new feature.
If you want to display the right error on the web page or at the bare minimum log the SQL exception, that is a bug fix.
I was suggesting the bug fix route since that is the fastest and easiest: you should already have that exception and instead of swallowing it, you should just log it as it should be already doing (because swallowing exceptions is a very bad practice)
@PrestaShop/prestashop-core-developers, what do you think?
I create a PR for checking if the user has the SELECT privilege on the database. Thanks @provirus
Most helpful comment
If you want to add a new pre check, yes that is a new feature.
If you want to display the right error on the web page or at the bare minimum log the SQL exception, that is a bug fix.
I was suggesting the bug fix route since that is the fastest and easiest: you should already have that exception and instead of swallowing it, you should just log it as it should be already doing (because swallowing exceptions is a very bad practice)