feat(legacy): disable services check when missing systemctl (#2160)

This commit is contained in:
Jonas L 2022-09-19 11:56:56 +02:00 committed by GitHub
parent 74539f75d8
commit 1edcbc0657
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 224 additions and 204 deletions

View File

@ -45,6 +45,11 @@ function checkDatabaseDependencies()
&& in_array('pgsql', $extensions);
}
function with_systemd()
{
return !empty(shell_exec('which systemctl'));
}
/**
* Check that all external services are configured correctly and return an associative
* array with the results.
@ -53,15 +58,20 @@ function checkDatabaseDependencies()
*/
function checkExternalServices()
{
return [
$result = [
'database' => checkDatabaseConfiguration(),
'analyzer' => checkAnalyzerService(),
'pypo' => checkPlayoutService(),
'liquidsoap' => checkLiquidsoapService(),
'rabbitmq' => checkRMQConnection(),
'celery' => checkCeleryService(),
'api' => checkApiService(),
];
if (with_systemd()) {
$result['analyzer'] = checkAnalyzerService();
$result['pypo'] = checkPlayoutService();
$result['liquidsoap'] = checkLiquidsoapService();
$result['celery'] = checkCeleryService();
$result['api'] = checkApiService();
}
return $result;
}
/**

View File

@ -15,12 +15,15 @@ $postgres = $phpDependencies['postgres'];
$database = $externalServices['database'];
$rabbitmq = $externalServices['rabbitmq'];
$systemd = with_systemd();
if ($systemd) {
$pypo = $externalServices['pypo'];
$liquidsoap = $externalServices['liquidsoap'];
$analyzer = $externalServices['analyzer'];
$celery = $externalServices['celery'];
$api = $externalServices['api'];
}
$r1 = array_reduce($phpDependencies, 'booleanReduce', true);
$r2 = array_reduce($externalServices, 'booleanReduce', true);
@ -155,6 +158,7 @@ $result = $r1 && $r2;
</td>
<?php } ?>
</tr>
<?php if ($systemd) { ?>
<tr class="<?php echo $analyzer ? 'success' : 'danger'; ?>">
<td class="component">
Media Analyzer
@ -250,6 +254,7 @@ $result = $r1 && $r2;
</td>
<?php } ?>
</tr>
<?php } ?>
</tbody>
</table>
</div>

View File

@ -10,11 +10,14 @@ $postgres = $phpDependencies["postgres"];
$database = $externalServices["database"];
$rabbitmq = $externalServices["rabbitmq"];
$pypo = $externalServices["pypo"];
$liquidsoap = $externalServices["liquidsoap"];
$analyzer = $externalServices["analyzer"];
$systemd = with_systemd();
if ($systemd) {
$pypo = $externalServices['pypo'];
$liquidsoap = $externalServices['liquidsoap'];
$analyzer = $externalServices['analyzer'];
$celery = $externalServices['celery'];
$api = $externalServices['api'];
}
$r1 = array_reduce($phpDependencies, "booleanReduce", true);
$r2 = array_reduce($externalServices, "booleanReduce", true);
@ -94,6 +97,7 @@ $result = $r1 && $r2;
?>
</td>
</tr>
<?php if ($systemd) { ?>
<tr>
<td class="component">
Media Analyzer
@ -199,6 +203,7 @@ $result = $r1 && $r2;
?>
</td>
</tr>
<?php } ?>
</tbody>
<tr id="partitions" class="even">
<th colspan="5"><?php echo _("Disk Space") ?></th>