Keep collations at utf8mb4_general_ci going forward: functions.php now ends by calling databaseConnectionCollation, which runs SET collation_connection = 'utf8mb4_general_ci' on the connection config.php opened, so a string the server makes itself, CAST(x AS CHAR) for one, matches the tables where on MySQL 8 it came out utf8mb4_0900_ai_ci and failed beside a column with Illegal mix of collations, on a new install as much as an upgraded one; only the collation is set and not the character set, no SET NAMES and no mysqli_set_charset, because on a server that defaults to latin1 the connection has always been latin1 and changing it shows every accented letter already stored as two wrong ones, where setting collation_connection alone leaves what is stored and what is stored after the same; admin/database_updates.php calls databaseCollationRepair after a run that applied at least one database update and finished, so a table a migration creates without a COLLATE is given the collation db.sql has in the same run, with what it changed and what it could not going to App Logs and to the output of scripts/update_cli.php, a table it cannot change left as it was and never failing the update, and a run that stops at a failed migration leaving this for the run that finishes; run on MySQL 8.0 and MariaDB 10.11, on a latin1 server default and through update_cli.php --update_db with a migration written as 2.4.1 was; CONTRIBUTING.md and the 26.11.7 changelog section say so

This commit is contained in:
johnnyq
2026-11-11 20:52:46 -05:00
parent bce68aac6a
commit 69fd43051f
6 changed files with 84 additions and 1 deletions

View File

@@ -194,6 +194,14 @@ foreach ($database_updates_applied as $applied_version) {
echo "Applied database update $applied_version\n";
}
// The collations the runner checked after them (admin/database_updates.php)
if (!empty($database_updates_collations['changed'])) {
echo "Gave " . (count($database_updates_collations['changed']) === 1 ? '1 table' : count($database_updates_collations['changed']) . ' tables') . " the collation db.sql has: " . implode(', ', $database_updates_collations['changed']) . "\n";
}
foreach ($database_updates_collations['failed'] ?? [] as $collation_table => $collation_why) {
echo "Warning: the table $collation_table doesn't have the collation db.sql has and could not be given it ($collation_why) - Admin > Debug lists it.\n";
}
if ($database_updates_error) {
$stopped_at_version = count($database_updates_applied) > 0 ? end($database_updates_applied) : $old_db_version;
fwrite(STDERR, "Error: database update failed at $database_updates_error\n");