Skip to content

[4.0] [Installation] Fix error when specifying a not existing database and not having privilege to create a new one#28345

Merged
wilsonge merged 4 commits intojoomla:4.0-devfrom
richard67:4.0-dev-installation-tweaks-4
Mar 17, 2020
Merged

[4.0] [Installation] Fix error when specifying a not existing database and not having privilege to create a new one#28345
wilsonge merged 4 commits intojoomla:4.0-devfrom
richard67:4.0-dev-installation-tweaks-4

Conversation

@richard67
Copy link
Copy Markdown
Member

@richard67 richard67 commented Mar 14, 2020

Pull Request for Issue #27924 .

Summary of Changes

This PR adds handling of exceptions which are thrown by the installation's database model in routine createDatabase but never were caught and handled so that e.g. the bad connfiguration file after a bad attemt to create the database was not deleted.

Testing Instructions

Requirements

  1. A database which fulfills the minimum server version requirements as they are
  • MySql: 5.6
  • MariaDB: 10.1
  • PostgreSQL: 11.0
  1. A database user who doesn not have the privilege to create a new database on that server with that kind of connection.
  2. An existing, empty database suitable for a new Joomla installation for which the user mentioned in condition 2 does have all privileges needed for Joomla installation, e.g. create tables, or alternatively another database user who has the permission to create new databases.

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, or alternatively change user to one who has the privilege to create a new database. Then use the "Install Joomla >" button again.

Result: For MySQLi and MySQL (PDO): See section "Actual result" below. For PostgreSQL (PDO). it might be like described in section "Expected result".

Step 4: Repeat steps 1 to 3 but this time with the patch of thos PR applied.

Result: See section "Expected result" below.

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 by using again the "Install Joomla >" button.

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, at least when using MySQLi or MySQL (PDO). For PostgreSQL the error could not be reproduced before..
j4-installation-tweaks-1_3

Documentation Changes Required

None.

In configuration model, delete configuration file in case of exceptions and re throw, in controller enqueue exception message in that case.
@richard67
Copy link
Copy Markdown
Member Author

Added release blocker label as inherited from issue #27924 .

@richard67
Copy link
Copy Markdown
Member Author

Thanks @wilsonge .

@jwaisner
Copy link
Copy Markdown
Member

I have tested this item ✅ successfully on e47670e

Tested successful with MySQLi


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/28345.

@Quy
Copy link
Copy Markdown
Contributor

Quy commented Mar 17, 2020

I have tested this item ✅ successfully on e47670e


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/28345.

@Quy
Copy link
Copy Markdown
Contributor

Quy commented Mar 17, 2020

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/28345.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Mar 17, 2020
@wilsonge wilsonge merged commit 65d2d14 into joomla:4.0-dev Mar 17, 2020
@wilsonge
Copy link
Copy Markdown
Contributor

Thanks!

@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Mar 17, 2020
@wilsonge wilsonge added this to the Joomla 4.0 milestone Mar 17, 2020
@richard67
Copy link
Copy Markdown
Member Author

Thanks, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants