mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-16 01:24:38 +00:00
src: style sweep
This commit is contained in:
parent
83524325fc
commit
20a6e85bff
@ -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"];
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user