Skip to content

Commit 389fb91

Browse files
committed
fix: show a better error message when we can't query locks in db:locks
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent c5cd9a8 commit 389fb91

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

core/Command/Db/DbLocks.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace OC\Core\Command\Db;
1111

12+
use Doctrine\DBAL\Exception\DriverException;
1213
use Doctrine\DBAL\Platforms\MySQLPlatform;
1314
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
1415
use OC\DB\Connection;
@@ -74,7 +75,16 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7475
return Command::SUCCESS;
7576
}
7677

77-
$rows = $this->connection->executeQuery($sql)->fetchAllAssociative();
78+
try {
79+
$rows = $this->connection->executeQuery($sql)->fetchAllAssociative();
80+
} catch (DriverException $e) {
81+
if ($e->getCode() === 1227) {
82+
$output->writeln('<comment>The configured database user doesn\'t have permissions to query active locks, PROCESS privilege required.</comment>');
83+
} else {
84+
$output->writeln('<comment>Failed to query active locks: ' . $e->getMessage() . '.</comment>');
85+
}
86+
return Command::FAILURE;
87+
}
7888

7989
if (empty($rows)) {
8090
$output->writeln('<info>No active locks or blocking transactions detected.</info>');

0 commit comments

Comments
 (0)