From fd88e7c86c9407a2863ebdf2a5897cb12f78ecad Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 10 Sep 2026 17:15:25 +0200 Subject: [PATCH 1/3] fix: fix db:info command on older mariadb and mysql Signed-off-by: Robin Appelman --- core/Command/Db/DbInfo.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/core/Command/Db/DbInfo.php b/core/Command/Db/DbInfo.php index f844e6fe65213..08d662043e3b3 100644 --- a/core/Command/Db/DbInfo.php +++ b/core/Command/Db/DbInfo.php @@ -9,6 +9,7 @@ namespace OC\Core\Command\Db; +use Doctrine\DBAL\Exception\DriverException; use Doctrine\DBAL\Platforms\MySQLPlatform; use Doctrine\DBAL\Platforms\PostgreSQLPlatform; use Doctrine\DBAL\Platforms\SqlitePlatform; @@ -76,11 +77,21 @@ protected function execute(InputInterface $input, OutputInterface $output): int } private function getMySQLInfo(): array { - $result = $this->connection->executeQuery( - 'SELECT VERSION() AS version, @@innodb_buffer_pool_size AS buffer_pool, + try { + return $this->getMySQLInfoUsingQuery( + 'SELECT VERSION() AS version, @@innodb_buffer_pool_size AS buffer_pool, @@max_connections AS max_conn, @@character_set_database AS charset, @@transaction_isolation AS tx_isolation' - ); + ); + } catch (DriverException $e) { + return $this->getMySQLInfoUsingQuery('SELECT VERSION() AS version, @@innodb_buffer_pool_size AS buffer_pool, + @@max_connections AS max_conn, @@character_set_database AS charset, + @@tx_isolation AS tx_isolation'); + } + } + + private function getMySQLInfoUsingQuery(string $query): array { + $result = $this->connection->executeQuery($query); $info = $result->fetchAssociative(); $bufferPoolGB = round(($info['buffer_pool'] / 1024 / 1024 / 1024), 2); From 190e8d94bf1d7e3282ad77914ec25fac298ca2c9 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 10 Sep 2026 17:22:24 +0200 Subject: [PATCH 2/3] fix: fix db:size command on mysql-like platforms Signed-off-by: Robin Appelman --- core/Command/Db/DbSize.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/Command/Db/DbSize.php b/core/Command/Db/DbSize.php index ceec7d8c18e51..8cd41b41fe8c4 100644 --- a/core/Command/Db/DbSize.php +++ b/core/Command/Db/DbSize.php @@ -45,7 +45,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int ROUND((data_length + index_length) / 1024 / 1024, 2) AS total_mb, ROUND(data_length / 1024 / 1024, 2) AS data_mb, ROUND(index_length / 1024 / 1024, 2) AS index_mb, - table_rows AS rows, + table_rows AS `rows`, IF(table_rows > 0, ROUND((data_length + index_length) / table_rows, 0), 0) AS avg_row_bytes FROM information_schema.tables WHERE table_schema = DATABASE() From 42be11e34d585611179b66b99d3e5e45dd020569 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 10 Sep 2026 17:27:42 +0200 Subject: [PATCH 3/3] fix: show a better error message when we can't query locks in db:locks Signed-off-by: Robin Appelman --- core/Command/Db/DbLocks.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/core/Command/Db/DbLocks.php b/core/Command/Db/DbLocks.php index 4bb336e9db884..6eb583cd80e58 100644 --- a/core/Command/Db/DbLocks.php +++ b/core/Command/Db/DbLocks.php @@ -9,6 +9,7 @@ namespace OC\Core\Command\Db; +use Doctrine\DBAL\Exception\DriverException; use Doctrine\DBAL\Platforms\MySQLPlatform; use Doctrine\DBAL\Platforms\PostgreSQLPlatform; use OC\DB\Connection; @@ -74,7 +75,16 @@ protected function execute(InputInterface $input, OutputInterface $output): int return Command::SUCCESS; } - $rows = $this->connection->executeQuery($sql)->fetchAllAssociative(); + try { + $rows = $this->connection->executeQuery($sql)->fetchAllAssociative(); + } catch (DriverException $e) { + if ($e->getCode() === 1227) { + $output->writeln('The configured database user doesn\'t have permissions to query active locks, PROCESS privilege required.'); + } else { + $output->writeln('Failed to query active locks: ' . $e->getMessage() . '.'); + } + return Command::FAILURE; + } if (empty($rows)) { $output->writeln('No active locks or blocking transactions detected.');