From f7e4aeb898462a9902fa7ae5ba3666eb022f144d Mon Sep 17 00:00:00 2001 From: Yasen Pramatarov Date: Wed, 4 Dec 2024 16:18:15 +0200 Subject: [PATCH] Adds jilo db checks to status page --- app/helpers/database.php | 3 +-- app/pages/status.php | 8 ++++++++ app/templates/status-platform.php | 3 +++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/helpers/database.php b/app/helpers/database.php index 2bce3e9..e52be11 100644 --- a/app/helpers/database.php +++ b/app/helpers/database.php @@ -7,8 +7,7 @@ function connectDB($config, $database = '', $dbFile = '', $platformId = '') { if ($database === 'jilo') { try { if (!$dbFile || !file_exists($dbFile)) { - throw new Exception(getError("Invalid platform ID \"{$platformId}\", database file \"{$dbFile}\" not found. -
Check the platform settings")); + throw new Exception(getError("Invalid platform ID \"{$platformId}\", database file \"{$dbFile}\" not found.")); } $db = new Database([ 'type' => 'sqlite', diff --git a/app/pages/status.php b/app/pages/status.php index 5d06a20..bb98cd4 100644 --- a/app/pages/status.php +++ b/app/pages/status.php @@ -16,6 +16,14 @@ include '../app/templates/status-server.php'; // loop through all platforms to check their agents foreach ($platformsAll as $platform) { + // check if we can connect to the jilo database + $response = connectDB($config, 'jilo', $platform['jilo_database'], $platform['id']); + if ($response['error'] !== null) { + $jilo_database_status = '' . htmlspecialchars($response['error']) . ''; + } else { + $jilo_database_status = 'OK'; + } + include '../app/templates/status-platform.php'; // fetch agent details for the current platform diff --git a/app/templates/status-platform.php b/app/templates/status-platform.php index 463f154..44d9e4e 100644 --- a/app/templates/status-platform.php +++ b/app/templates/status-platform.php @@ -5,6 +5,9 @@

Jitsi Meet platform: +
+ jilo database: , + status: