Apply fixes from StyleCI (#12117)

* Apply fixes from StyleCI

* Disable style check
This commit is contained in:
Jellyfrog
2020-09-21 14:54:51 +02:00
committed by GitHub
parent 8ec9183df5
commit 77c531527c
752 changed files with 6238 additions and 5833 deletions

View File

@@ -40,9 +40,9 @@ class Programs extends BaseValidation
public function validate(Validator $validator)
{
// Check programs
$bins = array('fping', 'rrdtool', 'snmpwalk', 'snmpget', 'snmpgetnext', 'snmpbulkwalk');
$bins = ['fping', 'rrdtool', 'snmpwalk', 'snmpget', 'snmpgetnext', 'snmpbulkwalk'];
foreach ($bins as $bin) {
if (!($cmd = $this->findExecutable($bin))) {
if (! ($cmd = $this->findExecutable($bin))) {
$validator->fail(
"$bin location is incorrect or bin not installed.",
"Install $bin or manually set the path to $bin by placing the following in config.php: " .
@@ -58,7 +58,7 @@ class Programs extends BaseValidation
public function checkFping6(Validator $validator, $fping)
{
$fping6 = $this->findExecutable('fping6');
$fping6 = (!is_executable($fping6) && is_executable($fping)) ? "$fping -6" : $fping6;
$fping6 = (! is_executable($fping6) && is_executable($fping)) ? "$fping -6" : $fping6;
$validator->execAsUser("$fping6 ::1 2>&1", $output, $return);
$output = implode(" ", $output);
@@ -69,11 +69,13 @@ class Programs extends BaseValidation
if ($output == '::1 address not found') {
$validator->warn("fping does not have IPv6 support?!?!");
return;
}
if (Str::contains($output, '::1 is unreachable') || Str::contains($output, 'Address family not supported')) {
$validator->warn("IPv6 is disabled on your server, you will not be able to add IPv6 devices.");
return;
}
@@ -104,13 +106,13 @@ class Programs extends BaseValidation
$getcap_out = shell_exec("$getcap $cmd");
preg_match("#^$cmd = (.*)$#", $getcap_out, $matches);
if (is_null($matches) || !Str::contains($matches[1], 'cap_net_raw+ep')) {
if (is_null($matches) || ! Str::contains($matches[1], 'cap_net_raw+ep')) {
$validator->fail(
"$cmd should have CAP_NET_RAW!",
"setcap cap_net_raw+ep $cmd"
);
}
} elseif (!(fileperms($cmd) & 2048)) {
} elseif (! (fileperms($cmd) & 2048)) {
$validator->fail("$cmd should be suid!", "chmod u+s $cmd");
}
}