[4.0] Adapt utf8mb4 conversion to latest changes in the 3.10-dev branch #29247
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request for Issue # .
Summary of Changes
When latest changes of the staging branch, which include PR #29117 , will be merged up into 3.10-dev, the utf8mb4 conversion in J4 has to be adapted to these changes so it doesn't run if not needed.
This is done with this Pull Request (PR) here.
As long as the upmerge has not happened yet, I'll keep this PR in draft status on GitHub and with "[WiP]" (work in progress) in the title.
Ideally both the upmerge from staging to 3.10-dev and the merge of this PR here happen before J4 Beta 1 is built, so that people can test updates from 3.10 to 4 using the latest 3.10 nightly as starting point.
Testing Instructions
Code review with respect to the changes in PR #29117 is sufficient.
But if someone insists on a real test ....
Preconditions
return false;
before the following line:https://github.com/joomla/joomla-cms/blob/3.10-dev/libraries/joomla/database/driver/mysqli.php#L961
so that funtion
serverClaimsUtf8mb4Support
always returns false.For the MySQL (PDO) driver it would be more complicated, therefore please test with the MySQLi driver.
php.ini
or.user.ini
file:log_errors = On;
error_log = "/full-path-to-log-folder/php-errors.log";
Alternatively, if PHP errors are logged already into your webserver's log file, just watch that log file during the tests.
Test 1: New installation
This test shall show that new installation is not broken by this PR.
Apply the patch of this PR to a clean 4.0-dev staging branch or a 4.0-beta1-dev nightly build.
Make a new installation into an empty database.
Log in to backend and go to "System - Information - Database".
Result: No database error is shown.
#__utf8_conversion
exists (replace#__
by your database prefix).Result: The table doesn't exist.
Result: All database tables have collation
utf8mb4_unicode_ci
.Test 2: Update without utf8mb4 conversion
Result: No SQL errors, all database tables have utf8mb4_unicode_ci collation.
'DEBUG: Running utf8mb4-conversion.sql.'
or'DEBUG: Running utf8mb4-conversion_optional.sql.'
.Result: No such logs.
Test 3: Update with utf8mb4 conversion
On a clean 3.0-dev from right now, or the next nightly build from tonight, patch the database driver as described in item 3 of the preconditions section above.
Make a new installation.
Result: All database tables have utf8_unicode_ci or utf8_general_ci collation.
Result: No SQL errors, all database tables have utf8mb4_unicode collation.
'DEBUG: Running utf8mb4-conversion.sql.'
or'DEBUG: Running utf8mb4-conversion_optional.sql.'
.Result: Both logs are shown if table
#__core_log_searches
existed before the update, otherwise only the first log is shown.Expected result
When updating a 3.10-dev which is not converted yet to utf8mb4, the conversion runs as well as before when updating to 4.
When updating a 3.10-dev which is already on utf8mb4, the conversion doesn't run when updating to 4.
Actual result
The utf8mb4 conversion runs also if a 3.10-dev which is already on utf8mb4 is updated to 4.
Documentation Changes Required
None.