From a40ca520d4036049de12f48c62d42c6aeaf7160a Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Sun, 16 Oct 2022 23:32:55 +0200 Subject: Port away from removed IDBConnection->isConnected method Instead track if the reconnection was successful with return value of connect method Signed-off-by: Carl Schwan --- apps/files_external/lib/Command/Notify.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'apps/files_external/lib/Command') diff --git a/apps/files_external/lib/Command/Notify.php b/apps/files_external/lib/Command/Notify.php index 340dd2fdca1..91bbd6d3354 100644 --- a/apps/files_external/lib/Command/Notify.php +++ b/apps/files_external/lib/Command/Notify.php @@ -308,19 +308,17 @@ class Notify extends Base { ->execute(); } - /** - * @return \OCP\IDBConnection - */ - private function reconnectToDatabase(IDBConnection $connection, OutputInterface $output) { + private function reconnectToDatabase(IDBConnection $connection, OutputInterface $output): IDBConnection { try { $connection->close(); } catch (\Exception $ex) { $this->logger->logException($ex, ['app' => 'files_external', 'message' => 'Error while disconnecting from DB', 'level' => ILogger::WARN]); $output->writeln("Error while disconnecting from database: {$ex->getMessage()}"); } - while (!$connection->isConnected()) { + $connected = false; + while (!$connected) { try { - $connection->connect(); + $connected = $connection->connect(); } catch (\Exception $ex) { $this->logger->logException($ex, ['app' => 'files_external', 'message' => 'Error while re-connecting to database', 'level' => ILogger::WARN]); $output->writeln("Error while re-connecting to database: {$ex->getMessage()}"); -- cgit v1.2.3