Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJulien Veyssier <eneiluj@posteo.net>2021-01-28 13:26:18 +0300
committerJulien Veyssier <eneiluj@posteo.net>2021-01-28 13:26:18 +0300
commit6f88fb15ba7693df88482226bc9b975073a5b6a4 (patch)
tree6e33e17cace2e41bdfcd0e01225dd10010249cdd /lib
parent95cfbeeaa4c8c33f0fb4eaa70fe08345cc696893 (diff)
refs #4776 recreate matterbridge config file if missing when launching
Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
Diffstat (limited to 'lib')
-rw-r--r--lib/MatterbridgeManager.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/MatterbridgeManager.php b/lib/MatterbridgeManager.php
index b41372305..a7cb2960b 100644
--- a/lib/MatterbridgeManager.php
+++ b/lib/MatterbridgeManager.php
@@ -160,8 +160,7 @@ class MatterbridgeManager {
$this->notify($room, $userId, $currentBridge, $newBridge);
- // edit/update the config file
- $this->editBridgeConfig($room, $newBridge);
+ $this->writeBridgeConfig($room, $newBridge);
// check state and manage the binary
$pid = $this->checkBridgeProcess($room, $newBridge);
@@ -238,13 +237,13 @@ class MatterbridgeManager {
}
/**
- * Edit the mattermost configuration file for one room
+ * Write the mattermost configuration file for one room
* This method takes care of connecting the bridge to the Talk room with a bot user
*
* @param Room $room
* @param array $newBridge
*/
- private function editBridgeConfig(Room $room, array $newBridge): void {
+ private function writeBridgeConfig(Room $room, array $newBridge): void {
// check bot user exists and is member of the room
// add the 'local' bridge part
$newBridge = $this->addLocalPart($room, $newBridge);
@@ -692,6 +691,13 @@ class MatterbridgeManager {
private function launchMatterbridge(Room $room): int {
$binaryPath = $this->config->getAppValue('spreed', 'matterbridge_binary');
$configPath = sprintf('/tmp/bridge-%s.toml', $room->getToken());
+
+ // recreate config file if it's not there (can happen after a reboot)
+ if (!file_exists($configPath)) {
+ $currentBridge = $this->getBridgeOfRoom($room);
+ $this->writeBridgeConfig($room, $currentBridge);
+ }
+
$outputPath = sprintf('/tmp/bridge-%s.log', $room->getToken());
$matterbridgeCmd = sprintf('%s -conf %s', $binaryPath, $configPath);
$cmd = sprintf('nice -n19 %s > %s 2>&1 & echo $!', $matterbridgeCmd, $outputPath);