diff options
author | Carl Schwan <carl@carlschwan.eu> | 2022-10-16 23:32:55 +0200 |
---|---|---|
committer | Carl Schwan <carl@carlschwan.eu> | 2022-10-16 23:32:55 +0200 |
commit | a40ca520d4036049de12f48c62d42c6aeaf7160a (patch) | |
tree | 128f4d650048517fec42647e25d9c3326560fcb4 /apps/files_external/lib/Command | |
parent | 386ef04e425071c67fd4ababed5847e1345b4493 (diff) | |
download | nextcloud-server-a40ca520d4036049de12f48c62d42c6aeaf7160a.tar.gz nextcloud-server-a40ca520d4036049de12f48c62d42c6aeaf7160a.zip |
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 <carl@carlschwan.eu>
Diffstat (limited to 'apps/files_external/lib/Command')
-rw-r--r-- | apps/files_external/lib/Command/Notify.php | 10 |
1 files changed, 4 insertions, 6 deletions
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("<info>Error while disconnecting from database: {$ex->getMessage()}</info>"); } - 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("<info>Error while re-connecting to database: {$ex->getMessage()}</info>"); |