From 56790b4b184be1e4764bdd0da06e8d8798f26447 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 24 Jun 2021 11:22:21 +0200 Subject: Don't spam the log when matterbridge is disabled Signed-off-by: Joas Schilling --- lib/BackgroundJob/CheckMatterbridges.php | 6 ++++-- lib/MatterbridgeManager.php | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/BackgroundJob/CheckMatterbridges.php b/lib/BackgroundJob/CheckMatterbridges.php index 34eca71a0..4b256f064 100644 --- a/lib/BackgroundJob/CheckMatterbridges.php +++ b/lib/BackgroundJob/CheckMatterbridges.php @@ -63,9 +63,11 @@ class CheckMatterbridges extends TimedJob { if ($this->serverConfig->getAppValue('spreed', 'enable_matterbridge', '0') === '1') { $this->bridgeManager->checkAllBridges(); $this->bridgeManager->killZombieBridges(); + $this->logger->info('Checked if Matterbridge instances are running correctly.'); } else { - $this->bridgeManager->stopAllBridges(); + if ($this->bridgeManager->stopAllBridges()) { + $this->logger->info('Stopped all Matterbridge instances as it is disabled'); + } } - $this->logger->info('Checked if Matterbridge instances are running correctly.'); } } diff --git a/lib/MatterbridgeManager.php b/lib/MatterbridgeManager.php index 34c437f51..4afd4eda6 100644 --- a/lib/MatterbridgeManager.php +++ b/lib/MatterbridgeManager.php @@ -843,7 +843,7 @@ class MatterbridgeManager { /** * Stop all bridges * - * @return bool success + * @return bool If bridges where stopped */ public function stopAllBridges(): bool { $query = $this->db->getQueryBuilder(); @@ -851,11 +851,11 @@ class MatterbridgeManager { $query->update('talk_bridges') ->set('enabled', $query->createNamedParameter(0, IQueryBuilder::PARAM_INT)) ->set('pid', $query->createNamedParameter(0, IQueryBuilder::PARAM_INT)); - $query->execute(); + $result = $query->executeStatement(); // finally kill all potential zombie matterbridge processes $this->killZombieBridges(true); - return true; + return $result !== 0; } /** -- cgit v1.2.3