From 079da62d444e61e26942347640ff836bde017922 Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Thu, 10 Sep 2026 15:28:25 +0200 Subject: [PATCH 1/2] fix(collation): Display errors when converting db Display errors in IOutput so that users can see them. Signed-off-by: Carl Schwan --- lib/private/Repair/Collation.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/private/Repair/Collation.php b/lib/private/Repair/Collation.php index 6ee951e82fda0..162eb28afa9bf 100644 --- a/lib/private/Repair/Collation.php +++ b/lib/private/Repair/Collation.php @@ -52,6 +52,7 @@ public function run(IOutput $output): void { } catch (DriverException $e) { // Just log this $this->logger->error($e->getMessage(), ['exception' => $e]); + $output->warning($e->getMessage()); if (!$this->ignoreFailures) { throw $e; } @@ -64,6 +65,7 @@ public function run(IOutput $output): void { } catch (DriverException $e) { // Just log this $this->logger->error($e->getMessage(), ['exception' => $e]); + $output->warning($e->getMessage()); if (!$this->ignoreFailures) { throw $e; } From 6026bb939bfc034c5b9db0e097dc336cd99f0b03 Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Thu, 10 Sep 2026 15:58:39 +0200 Subject: [PATCH 2/2] fix(collation): correctly handle utf8mb3 Assisted-By: Claude:claude-sonnet-5 Signed-off-by: Carl Schwan --- lib/private/Repair/Collation.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/private/Repair/Collation.php b/lib/private/Repair/Collation.php index 162eb28afa9bf..bec903a929b1d 100644 --- a/lib/private/Repair/Collation.php +++ b/lib/private/Repair/Collation.php @@ -83,12 +83,22 @@ protected function getAllNonUTF8BinTables(IDBConnection $connection): array { $dbName = $this->config->getSystemValueString('dbname'); $characterSet = $this->config->getSystemValueBool('mysql.utf8mb4', false) ? 'utf8mb4' : 'utf8'; + // Since MySQL 8.0.30, INFORMATION_SCHEMA reports the legacy 3-byte utf8 + // charset/collation as "utf8mb3" instead of the "utf8" alias used to + // create it, so both names have to be accepted or already-correct + // tables get flagged as needing repair on every run. + // See https://dev.mysql.com/doc/refman/8.0/en/charset-unicode-utf8mb3.html + $acceptedCharsets = $characterSet === 'utf8' ? ['utf8', 'utf8mb3'] : [$characterSet]; + $acceptedCollations = array_map(static fn (string $charset): string => $charset . '_bin', $acceptedCharsets); + $charsetList = "'" . implode("', '", $acceptedCharsets) . "'"; + $collationList = "'" . implode("', '", $acceptedCollations) . "'"; + // fetch tables by columns $statement = $connection->executeQuery( 'SELECT DISTINCT(TABLE_NAME) AS `table`' . ' FROM INFORMATION_SCHEMA . COLUMNS' . ' WHERE TABLE_SCHEMA = ?' - . " AND (COLLATION_NAME <> '" . $characterSet . "_bin' OR CHARACTER_SET_NAME <> '" . $characterSet . "')" + . " AND (COLLATION_NAME NOT IN ($collationList) OR CHARACTER_SET_NAME NOT IN ($charsetList))" . " AND TABLE_NAME LIKE '*PREFIX*%'", [$dbName] ); @@ -103,7 +113,7 @@ protected function getAllNonUTF8BinTables(IDBConnection $connection): array { 'SELECT DISTINCT(TABLE_NAME) AS `table`' . ' FROM INFORMATION_SCHEMA . TABLES' . ' WHERE TABLE_SCHEMA = ?' - . " AND TABLE_COLLATION <> '" . $characterSet . "_bin'" + . " AND TABLE_COLLATION NOT IN ($collationList)" . " AND TABLE_NAME LIKE '*PREFIX*%'", [$dbName] );