User tests: Successful: Unsuccessful:
Pull Request for Issue #.
Fix utf8mb4 conversion for Joomla 4.
In Joomla 4, the version requirements make sure that one can only do a new installation of J4 if the MySQL or MariaDB database supports utf8mb4.
For updated installations we could assume they have already been converted to utf8mb4, but it can happen that the site admin has forgotten to use "Fix" button in "Extensions -> Manage -> Database" after having migrated or updated his Joomla 3.10 database to a new database server, and so we still have to do the conversion when updating to J4 in that case.
Therefore we can't remove the utf8mb4 conversion completely from J4.
But we can do following:
#__utf8_conversion
anymore at new installation and don't initialize it anymore in the installation's database model.#__utf8_conversion
if the utf8mb4 conversion has been successfully done.In addition to what we can do, we have to adapt the utf8mb4 conversion to changes in database schema in J4, otherwise it will fail. These changes are:
#__core_log_searches
has been removed in J4 for new installations and so has to be removed from the conversion of core tables. But it still may exist on updated installations. Therefore a new step for optional conversions has to be added, which allows the table not to exist.#_finder_...
tables of Smart Search (com_finder) are all restructured with the update SQL script 4.0.0-2018-07-29.sql
at update and so will already have utf8mb4 character set, so they have to be removed from the conversion.This Pull Request (PR) does all of the above.
This test shall show that new installation is not broken by this PR.
Step 1: Apply the patch of this PR to a clean 4.0-dev staging branch or a 4.0-beta1-dev nightly build.
Step 2: Make a new installation into an empty database.
Step 3: Log in to backend and go to "System - Information - Database".
Result: No database error is shown.
Step 4: Check with a tool like e.g. PhpMyAdmin in your database if a table named #__utf8_conversion
exists (replace #__
by your database prefix).
Result: The table doesn't exist.
Step 5: Check with the same tool the collation of all core tables.
Result: All database tables have collation utf8mb4_unicode_ci
.
This test has to be executed immediately after the previous test "Test 1".
It shall make sure that this PR doesn't break updating a J4 to a later J4 version.
Step 1: On the J4 from the previous test "Test 1", login to backend and do an update to the update package of this PR with the Joomla Update Component. You can find the links to the custom update URL or update packages downloads for this PR here: https://ci.joomla.org/artifacts/joomla/joomla-cms/4.0-dev/28515/downloads/32191/.
Step 2: After the update has finished, go to "System - Information - Database".
Result: Only one database error is shown about wrong version. This is normal for update packages build for PRs and so can be ignored.
Step 3: Check with a tool like e.g. PhpMyAdmin the collation of all core tables.
Result: All database tables still have collation utf8mb4_unicode_ci
.
This test shall show that an update from 3.10 with utf8mb4 conversion is broken without this PR.
Step 1: Make a new installation of Joomla 3.10-dev or recent 3.10 nightly on an old database server which does not support utf8mb4 in case if you can do later a migration or an update, otherwise use a database server which supports utf8mb4 and use following installation package patched to simulate missing utf8mb4 support: https://test5.richard-fath.de/Joomla_3.10.0-dev-Development-Full_Package_2020-05-17_no-utf8mb4.zip.
Step 2: Using a tool like e.g. PhpMyAdmin, check collations of all core database tables.
Result: All tables have collations starting with utf8_
.
Step 3: Login to backend and do an update to the latest 4.0 nightly build with the Joomla Update Component. You can find the links to the nightlies custom update URL or update packages downloads here: https://developer.joomla.org/nightly-builds.html.
Step 4: After the update has finished, go to "System - Information - Database".
Result: There are no database errors shown.
Step 5: Check with a tool like e.g. PhpMyAdmin in your database if a table named #__utf8_conversion
exists (replace #__
by your database prefix).
Result: The table exists.
Step 6: Check with the same tool the collation of all core tables.
Result: Some of the database tables have collation utf8mb4_unicode_ci
, some still have collations starting with utf8_.
The tables with collation utf8mb4_unicode_ci
are
This test shall show that this PR fixes the error reproduced in the previous test "Test 3", and the in J4 unneccessary utf8mb4 conversion related code and database table are removed with the update if the conversion has been successful.
Step 1: Make a new installation of Joomla 3.10-dev or recent 3.10 nightly on an old database server which does not support utf8mb4 in case if you can do later a migration or an update, otherwise use a database server which supports utf8mb4 and use following installation package patched to simulate missing utf8mb4 support: https://test5.richard-fath.de/Joomla_3.10.0-dev-Development-Full_Package_2020-05-17_no-utf8mb4.zip.
Step 2: Using a tool like e.g. PhpMyAdmin, check collations of all core database tables.
Result: All tables have collations starting with utf8_
.
Step 3: Login to backend and do an update to the update package of this PR with the Joomla Update Component. You can find the links to the custom update URL or update packages downloads for this PR here: https://ci.joomla.org/artifacts/joomla/joomla-cms/4.0-dev/28515/downloads/32191/.
Step 4: After the update has finished, go to "System - Information - Database".
Result: Only one database error is shown about wrong version. This is normal for update packages build for PRs and so can be ignored.
Step 5: Check with a tool like e.g. PhpMyAdmin in your database if a table named #__utf8_conversion
exists (replace #__
by your database prefix).
Result: The table doesn't exist.
Step 6: Check with the same tool the collation of all core tables.
Result: All database tables have collation utf8mb4_unicode_ci
.
This test shall show that an update from 3.10 without utf8mb4 conversion is not broken by this PR, and the in J4 unneccessary utf8mb4 conversion related code and database table are removed with the update.
Step 1: Make a new installation of Joomla 3.10-dev or recent 3.10 nightly on an database server which does support utf8mb4. You can find the latest noghtly build here: https://developer.joomla.org/nightly-builds.html.
Step 2: Using a tool like e.g. PhpMyAdmin, check collations of all core database tables.
Result: All tables have collations starting with utf8mb4_
. Some have general and some have unicode collation.
Step 3: Login to backend and do an update to the update package of this PR with the Joomla Update Component. You can find the links to the custom update URL or update packages downloads for this PR here: https://ci.joomla.org/artifacts/joomla/joomla-cms/4.0-dev/28515/downloads/32191/.
Step 4: After the update has finished, go to "System - Information - Database".
Result: Only one database error is shown about wrong version. This is normal for update packages build for PRs and so can be ignored.
Step 5: Check with a tool like e.g. PhpMyAdmin in your database if a table named #__utf8_conversion
exists (replace #__
by your database prefix).
Result: The table doesn't exist.
Step 6: Check with the same tool the collation of all core tables.
Result: All database tables have collation utf8mb4_unicode_ci
.
This test shall show that updating with utf8mb4 conversion also works if com_search has been removed before the update.
Instructions: Execute "Test 4" again, but before doing the update with step 3, do following:
com_search
:#__core_log_searches
from database (replace #__
by your database prefix).Result: Same as for "Test 4".
Last step: Check with a tool like e.g. PhpMyAdmin in your database if a table named #__core_log_searches
exists (replace #__
by your database prefix).
Result: The table still doesn't exist.
This test shall show that updating without utf8mb4 conversion also works if com_search has been removed before the update.
Instructions: Execute "Test 5" again, but before doing the update with step 3, do following:
com_search
:#__core_log_searches
from database (replace #__
by your database prefix).Result: Same as for "Test 5".
Last step: Check with a tool like e.g. PhpMyAdmin in your database if a table named #__core_log_searches
exists (replace #__
by your database prefix).
Result: The table still doesn't exist.
#__utf8_conversion
table is created anymore.utf8mb4_unicode_ci
.utf8mb4_unicode_ci
.#__utf8_conversion
table doesn't exist anymore.No issues, but there is a lot of useless stuff like the database table #__utf8_conversion
or query downgrade which is not needed anymore on J4 where we are sure the database supports utf8mb4.
utf8mb4_unicode_ci
, some still have collations starting with utf8_
.None.
Status | New | ⇒ | Pending |
Category | ⇒ | SQL Installation |
Title |
|
Labels |
Added:
?
|
Category | SQL Installation | ⇒ | Administration com_admin Language & Strings SQL Installation Libraries |
Title |
|
Labels |
Added:
?
|
Category | SQL Installation Administration com_admin Language & Strings Libraries | ⇒ | Administration com_admin com_installer Language & Strings SQL Installation Libraries |
Labels |
Added:
?
|
Title |
|
Ready for reviews and tests.
Wait, I have to extend this PR a bit by the handling of table #__core_log_searches
, which belongs to com_search
and might or might not exist on an updated installation.
Update: Done.
A perfect testing instruction, so it is an easy test but very time consuming.
I Made the test on localhost, win 10, xampp
Apache/2.4.41 (Win64) OpenSSL/1.1.1c PHP/7.4.3
PHP-Version: 7.4.3
Server-Version: 10.4.11-MariaDB - mariadb.org binary distribution
Test 1: New installation: All tests OK
Test 2: Update without utf8mb4 conversion from 3.10 to 4.0-dev without this PR to reproduce issue #28873
Could not reproduce the issue. No Database inconsistencies were found. I used for Update the xml for nightly build
Test 3: Update without utf8mb4 conversion from 3.10 to 4.0-dev + this PR applied
Using live update: Test Result as described
Using "Upload & Update" with the package .zip:
Gave up. After 15 Minuts the Update process was at 1.9%.
to be continued ...
@chmst It is enough to test either with custom url or with upload zip, but not necessary to test both. If upload zip times out, the reason might be that J4 update packages meanwhile exceeed PHP limits (upload_max_filesize and post_max_size) on some systems (e.g. when they are 16MB; the J4 update package meanwhile has some 24MB).
Regarding reproducing the issue: Read the issue description. It does not say the errors are shown in the database checker, it says the erroes are shown together will the usual template error. So your descriptions of your test for reproducing the issue does not fit to the description in the issue.
@chmst With reproducing the issue you could be right: It may be that since the recent upmerge of the 3.10-dev branch to the 4.0-dev branch, the issue can't be reproduced anymore. I will check that and if necessary adjust description and testing instructions and report back here. This PR here will still be necessary because it still fixes utf8mb4 conversion on J4, which will not work without errors without this PR.
Was one last change. Will be ready for testing as soon as drone has built the packages and I've updated the corresponding links in the testing instructions.
Done.
Drone failure seems not to be related to this PR.
Status | Pending | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-05-17 18:04:50 |
Closed_By | ⇒ | wilsonge |
Thanks!
Thanks.
Release blocker label