? ? Pending

User tests: Successful: Unsuccessful:

avatar richard67
richard67
8 Mar 2020

Pull Request for Issue #27924 .

Summary of Changes

What this PR changes and fixes:

  • Let function CreateDatabase of the database model enqueue messages and return false in case of errors, like it is expected by the calling functions, and not throw exceptions. This fixes issue #27924 .
  • Move variables for CMS requirements for minimum database server versions which have been introduced with PR #28135 from the setup model to the database helper and added a function to get the relevant value for the particular database type, which is the maximum of either the database driver's or the CMS' requirement.
  • Let both setup and database model use the same check for the minimum required version from the database helper. The setup model checks this if the database already exists, and the database model will check that later when trying to create a database.
  • Added the check for database encryption capabilities of the server to the database model for the same case (newly created database).

What this PR doesn't fix:

Depending on the particular database driver, exception texts in error messages are more or less meaningful. This PR doesn't change that.

Testing Instructions

Step 1: Start a new installation of a current 4.0-dev without the patch of this PR applied.

Step 2: When coming to the database information, enter a valid server and a valid user name and password for a user who doesn't have the privilege to create databases. Enter a database name for which no database exists. When having filled out all fields, use the "Install Joomla >" button to start the installation.

Result: Depending on the particular database driver you see a more or less meaningful error message.

Step 3: Correct the database name so it fits to an existing database for which the previously entered user has all privileges required for a Joomla installation. Then use the "Install Joomla >" button again.
Result: See issue #27924 and section "Actual result" below.

Step 4: Delete configuration.php, and either delete the session cookies in your browser settings or close wour browser window and open it again.

Step 5: Apply the patch of this PR.

Step 6: Start a new installation of a current 4.0-dev with the patch of this PR applied.

Step 7: Repeat steps 2 and 3 above.

Result: Installation continues with the corrected database name, see section "Expected result" below.

Step 8: Delete again configuration.php, and again either delete the session cookies in your browser settings or close wour browser window and open it again.

Step 9: Start again a new installation of a current 4.0-dev with the patch of this PR applied.

Step 10: When coming to the database information, test that the version checks introduced with PR #28135 still work, i.e. either use a databas server which doesn't fulfill the minimum version requirement by either the database driver or the CMS, or patch either the database driver's or the CMS' requirement so it isn't fulfilled by your database server.

The CMS's requirements for the particular database types can be found and if necessary patched here:

/**
* The minimum database server version for MariaDB databases as required by the CMS.
* This is not necessarily equal to what the database driver requires.
*
* @var string
* @since 4.0.0
*/
protected static $dbMinimumMariaDb = '10.1';
/**
* The minimum database server version for MySQL databases as required by the CMS.
* This is not necessarily equal to what the database driver requires.
*
* @var string
* @since 4.0.0
*/
protected static $dbMinimumMySql = '5.6';
/**
* The minimum database server version for PostgreSQL databases as required by the CMS.
* This is not necessarily equal to what the database driver requires.
*
* @var string
* @since 4.0.0
*/
protected static $dbMinimumPostgreSql = '11.0';

Result: The check for the minimum required database server version still works for any kind of database. If the requirement is not fulfilled, it is possible to change to another database which fulfills the requirement (or patch the requirement) and continue with the installation.

The next test steps 11 to 13 currently only work (with or without this PR) for MySQLi and MySQL (PDO) but not for PostgreSQL (PDO). I have no idea how it is with MariaDB. PostgreSQL users please skip this test and count is as successful. I will fix installation of new database for PostgreSQL with a later PR.

Step 11: Delete again configuration.php, and again either delete the session cookies in your browser settings or close wour browser window and open it again.

Step 12: Start again a new installation of a current 4.0-dev with the patch of this PR applied.

Step 13: When coming to the database information, enter a valid server and a valid user name and password for a user who has the privilege to create databases, e.g. "root" on MySQL. Enter a database name for which no database exists. When having filled out all fields, use the "Install Joomla >" button to start the installation.

Result: Creating the database works as well as before for MySQLi and MySQL (PDO).

Expected result

When entering a not existing database as database name in the installation form and a user who doesn't have the permission to create a database, you can correct database or user information after the error message and then continue with the installation.

Actual result

When entering a not existing database as database name in the installation form and a user who doesn't have the permission to create a database, and then after the error message correct database or user information and start the installation again, it stops with an unspecified database error, see issue #27924 .

Documentation Changes Required

None.

avatar richard67 richard67 - open - 8 Mar 2020
avatar richard67 richard67 - change - 8 Mar 2020
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 8 Mar 2020
Category Installation
avatar richard67 richard67 - change - 8 Mar 2020
Labels Added: ?
avatar richard67 richard67 - change - 8 Mar 2020
The description was changed
avatar richard67 richard67 - edited - 8 Mar 2020
avatar richard67 richard67 - change - 8 Mar 2020
The description was changed
avatar richard67 richard67 - edited - 8 Mar 2020
avatar richard67 richard67 - change - 8 Mar 2020
The description was changed
avatar richard67 richard67 - edited - 8 Mar 2020
avatar richard67 richard67 - change - 8 Mar 2020
The description was changed
avatar richard67 richard67 - edited - 8 Mar 2020
avatar richard67 richard67 - change - 8 Mar 2020
The description was changed
avatar richard67 richard67 - edited - 8 Mar 2020
avatar richard67 richard67 - change - 8 Mar 2020
The description was changed
avatar richard67 richard67 - edited - 8 Mar 2020
avatar richard67 richard67 - change - 8 Mar 2020
The description was changed
avatar richard67 richard67 - edited - 8 Mar 2020
avatar richard67 richard67 - change - 8 Mar 2020
The description was changed
avatar richard67 richard67 - edited - 8 Mar 2020
avatar richard67 richard67 - change - 8 Mar 2020
Title
[4.0] [WiP] Fix error in installation when specifying a not existing database
[4.0] Fix error in installation when specifying a not existing database and correct version check for that case
avatar richard67 richard67 - edited - 8 Mar 2020
avatar richard67
richard67 - comment - 8 Mar 2020

@Oemand Please test.

avatar richard67
richard67 - comment - 8 Mar 2020

Added release blocker label as inherited from issue #27924 .

avatar richard67 richard67 - change - 8 Mar 2020
Title
[4.0] Fix error in installation when specifying a not existing database and correct version check for that case
[4.0] Fix error in installation when specifying a not existing database
avatar richard67 richard67 - edited - 8 Mar 2020
avatar richard67 richard67 - change - 8 Mar 2020
Title
[4.0] Fix error in installation when specifying a not existing database
[4.0] Fix errors in installation when specifying a not existing database
avatar richard67 richard67 - edited - 8 Mar 2020
avatar richard67 richard67 - edited - 8 Mar 2020
avatar richard67 richard67 - change - 8 Mar 2020
The description was changed
avatar brianteeman
brianteeman - comment - 8 Mar 2020

(FYI for those of us that follow the tracker by email - we only get the first post and not the edited post)

avatar richard67
richard67 - comment - 8 Mar 2020

Please wait a bit with testing .. have to fix the case for new db creation for MySQL (PDO).
Update: Fixed. Ready for tests.

avatar richard67 richard67 - change - 8 Mar 2020
Labels Added: ?
avatar richard67
richard67 - comment - 8 Mar 2020

(FYI for those of us that follow the tracker by email - we only get the first post and not the edited post)

@brianteeman What are you refering to? Did I do something wrong?

avatar richard67
richard67 - comment - 8 Mar 2020

PR is ready for tests.

avatar wilsonge
wilsonge - comment - 9 Mar 2020

Don't kill me. But can we keep the model throw exceptions and convert to the exception enqueueMessage in the controller with a standard try/catch? Just keep options open for install Joomla from CLI in the future where we're going to want to have exceptions converted to a different sort of output in 4.x versions.

avatar richard67
richard67 - comment - 9 Mar 2020

@wilsonge grrr ... shouldn’t the Initialize function in the database model be changed to exceptions, too?

avatar wilsonge
wilsonge - comment - 9 Mar 2020

At a quick look - Yes probably

avatar richard67
richard67 - comment - 9 Mar 2020

Isn’t there another way? Like it is now (without my PR) it is definitely not working either.

avatar wilsonge
wilsonge - comment - 9 Mar 2020

All I'm saying is throw the exception in the model (like now) but then change is catch the exception here https://github.com/joomla/joomla-cms/blob/staging/installation/controller/database.php#L52

Then in the catch use $app->sendJsonResponse($e);

avatar richard67
richard67 - comment - 9 Mar 2020

Closing as this PR is correct and solves the issues but goes into a wrong direction, see @wilsonge 's comment above.

Will reopen the issue as long as I don't have a new PR.

Will try to make a new one but it may take some days until I find time, very likely weekend.

avatar richard67 richard67 - change - 9 Mar 2020
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2020-03-09 18:20:06
Closed_By richard67
avatar richard67 richard67 - close - 9 Mar 2020

Add a Comment

Login with GitHub to post a comment