mvc: make enabled checks consistent

Spotted by: @dharrigan
This commit is contained in:
Franco Fichtner 2018-01-04 13:36:19 +01:00
parent 48b164a1a6
commit 6ccadfb55e

View File

@ -199,14 +199,14 @@ abstract class ApiMutableServiceControllerBase extends ApiControllerBase
$response = $backend->configdRun(escapeshellarg(static::$internalServiceName) . ' status');
if (strpos($response, 'not running') > 0) {
if ((string)$model->getNodeByReference(static::$internalServiceEnabled) == 1) {
if ((string)$model->getNodeByReference(static::$internalServiceEnabled) == '1') {
$status = 'stopped';
} else {
$status = 'disabled';
}
} elseif (strpos($response, 'is running') > 0) {
$status = 'running';
} elseif ((string)$model->getNodeByReference(static::$internalServiceEnabled) == 0) {
} elseif ((string)$model->getNodeByReference(static::$internalServiceEnabled) == '0') {
$status = 'disabled';
} else {
$status = 'unknown';