Adds jilo db checks to status page

main
Yasen Pramatarov 2024-12-04 16:18:15 +02:00
parent 1f7d42b083
commit f7e4aeb898
3 changed files with 12 additions and 2 deletions

View File

@ -7,8 +7,7 @@ function connectDB($config, $database = '', $dbFile = '', $platformId = '') {
if ($database === 'jilo') { if ($database === 'jilo') {
try { try {
if (!$dbFile || !file_exists($dbFile)) { if (!$dbFile || !file_exists($dbFile)) {
throw new Exception(getError("Invalid platform ID \"{$platformId}\", database file \"{$dbFile}\" not found. throw new Exception(getError("Invalid platform ID \"{$platformId}\", database file \"{$dbFile}\" not found."));
<br />Check the <a href=\"?page=config&item=platform&platform={$platformId}&action=edit\">platform settings</a>"));
} }
$db = new Database([ $db = new Database([
'type' => 'sqlite', 'type' => 'sqlite',

View File

@ -16,6 +16,14 @@ include '../app/templates/status-server.php';
// loop through all platforms to check their agents // loop through all platforms to check their agents
foreach ($platformsAll as $platform) { 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 = '<span class="text-danger">' . htmlspecialchars($response['error']) . '</span>';
} else {
$jilo_database_status = '<span class="text-success">OK</span>';
}
include '../app/templates/status-platform.php'; include '../app/templates/status-platform.php';
// fetch agent details for the current platform // fetch agent details for the current platform

View File

@ -5,6 +5,9 @@
<div class="card-body"> <div class="card-body">
<p class="card-text text-left" style="text-align: left;"> <p class="card-text text-left" style="text-align: left;">
Jitsi Meet platform: <a href="<?= htmlspecialchars($app_root) ?>?page=config#platform<?= htmlspecialchars($platform['id']) ?>"><?= htmlspecialchars($platform['name']) ?></a> Jitsi Meet platform: <a href="<?= htmlspecialchars($app_root) ?>?page=config#platform<?= htmlspecialchars($platform['id']) ?>"><?= htmlspecialchars($platform['name']) ?></a>
<br />
jilo database: <strong><?= htmlspecialchars($platform['jilo_database']) ?></strong>,
status: <strong><?= $jilo_database_status ?></strong>
</p> </p>
</div> </div>
</div> </div>