diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Core/Api/SystemController.php b/src/opnsense/mvc/app/controllers/OPNsense/Core/Api/SystemController.php index 074636c81..9903dda34 100644 --- a/src/opnsense/mvc/app/controllers/OPNsense/Core/Api/SystemController.php +++ b/src/opnsense/mvc/app/controllers/OPNsense/Core/Api/SystemController.php @@ -70,7 +70,7 @@ class SystemController extends ApiControllerBase $order = [-1 => 'Error', 0 => 'Warning', 1 => 'Notice', 2 => 'OK']; $acl = new ACL(); - foreach($statuses as $subsystem => $status) { + foreach ($statuses as $subsystem => $status) { $statuses[$subsystem]['status'] = $order[$status['statusCode']]; if (!empty($status['logLocation'])) { if (!$acl->isPageAccessible($this->getUserName(), $status['logLocation'])) { @@ -82,7 +82,7 @@ class SystemController extends ApiControllerBase } /* Sort on the highest error level after the ACL check */ - $statusCodes = array_map(function($v) { + $statusCodes = array_map(function ($v) { return $v['statusCode']; }, array_values($statuses)); sort($statusCodes); @@ -108,8 +108,10 @@ class SystemController extends ApiControllerBase if (array_key_exists($subsystem, $system)) { if (!empty($system[$subsystem]['logLocation'])) { $aclCheck = $system[$subsystem]['logLocation']; - if ($acl->isPageAccessible($this->getUserName(), $aclCheck) || - !$acl->hasPrivilege($this->getUserName(), 'user-config-readonly')) { + if ( + $acl->isPageAccessible($this->getUserName(), $aclCheck) || + !$acl->hasPrivilege($this->getUserName(), 'user-config-readonly') + ) { $status = trim($backend->configdRun(sprintf('system dismiss status %s', $subsystem))); if ($status == "OK") { return [ @@ -117,10 +119,8 @@ class SystemController extends ApiControllerBase ]; } } - } } - } return ["status" => "failed"]; diff --git a/src/opnsense/mvc/app/library/OPNsense/System/Status/CrashReporterStatus.php b/src/opnsense/mvc/app/library/OPNsense/System/Status/CrashReporterStatus.php index 887dc5c91..e6480ee02 100644 --- a/src/opnsense/mvc/app/library/OPNsense/System/Status/CrashReporterStatus.php +++ b/src/opnsense/mvc/app/library/OPNsense/System/Status/CrashReporterStatus.php @@ -31,8 +31,8 @@ namespace OPNsense\System\Status; use OPNsense\System\AbstractStatus; use OPNsense\Core\Config; -class CrashReporterStatus extends AbstractStatus { - +class CrashReporterStatus extends AbstractStatus +{ public function __construct() { $this->internalLogLocation = '/crash_reporter.php'; @@ -50,7 +50,7 @@ class CrashReporterStatus extends AbstractStatus { if (Config::getInstance()->object()->system->deployment == 'development') { if ($has_crashed) { $this->internalMessage = gettext( - "A problem was detected, but non-production deployment is configured so crash reports cannot be sent." + "A problem was detected, but non-production deployment is configured so crash reports cannot be sent." ); $this->internalStatus = static::STATUS_NOTICE; } diff --git a/src/opnsense/mvc/app/library/OPNsense/System/Status/FirewallStatus.php b/src/opnsense/mvc/app/library/OPNsense/System/Status/FirewallStatus.php index dcd62477b..54c5cfa95 100644 --- a/src/opnsense/mvc/app/library/OPNsense/System/Status/FirewallStatus.php +++ b/src/opnsense/mvc/app/library/OPNsense/System/Status/FirewallStatus.php @@ -32,7 +32,6 @@ use OPNsense\System\AbstractStatus; class FirewallStatus extends AbstractStatus { - public function __construct() { $this->internalLogLocation = '/ui/diagnostics/log/core/firewall'; @@ -47,5 +46,4 @@ class FirewallStatus extends AbstractStatus { @unlink('/tmp/rules.error'); } - } diff --git a/src/opnsense/mvc/app/library/OPNsense/System/SystemStatus.php b/src/opnsense/mvc/app/library/OPNsense/System/SystemStatus.php index 670e605e3..7ef63edbb 100644 --- a/src/opnsense/mvc/app/library/OPNsense/System/SystemStatus.php +++ b/src/opnsense/mvc/app/library/OPNsense/System/SystemStatus.php @@ -51,13 +51,13 @@ class SystemStatus $result = []; $statusCodes = []; $all = scandir(__DIR__ . '/Status'); - $classes = array_map(function($file) { + $classes = array_map(function ($file) { if (strpos($file, 'Status') !== false) { return '\\OPNsense\\System\\Status\\' . str_replace('.php', '', $file); } }, $all); - $statuses = array_filter($classes, function($class) { + $statuses = array_filter($classes, function ($class) { return class_exists($class) && is_subclass_of($class, '\\OPNsense\\System\\AbstractStatus'); }); @@ -96,5 +96,4 @@ class SystemStatus $this->objectMap[$subsystem]->dismissStatus(); } } - }