diff --git a/lib/OperatingSystems/FreeBSD.php b/lib/OperatingSystems/FreeBSD.php index 83a852bb..5535818b 100644 --- a/lib/OperatingSystems/FreeBSD.php +++ b/lib/OperatingSystems/FreeBSD.php @@ -98,24 +98,21 @@ public function getUptime(): int { } public function getNetworkInfo(): array { - $result = []; - $result['hostname'] = \gethostname(); + $result = [ + 'gateway' => '', + 'hostname' => \gethostname(), + ]; try { - $dns = $this->executeCommand('cat /etc/resolv.conf 2>/dev/null'); - preg_match_all("/(?<=^nameserver ).\S*/m", $dns, $matches); - $alldns = implode(' ', $matches[0]); - $result['dns'] = $alldns; $netstat = $this->executeCommand('netstat -rn'); preg_match_all("/(?<=^default)\s*[0-9a-fA-f\.:]+/m", $netstat, $gw); if (count($gw[0]) > 0) { $result['gateway'] = implode(", ", array_map("trim", $gw[0])); - } else { - $result['gateway'] = ''; } - } catch (RuntimeException $e) { - return $result; + } catch (RuntimeException) { + // okay } + return $result; } diff --git a/lib/OperatingSystems/IOperatingSystem.php b/lib/OperatingSystems/IOperatingSystem.php index 512b7e1f..7c99bdaf 100644 --- a/lib/OperatingSystems/IOperatingSystem.php +++ b/lib/OperatingSystems/IOperatingSystem.php @@ -42,7 +42,6 @@ public function getMemory(): Memory; * Get info about network connection. * * [ - * 'dns' => string, * 'gateway' => string, * 'hostname' => string, * ] diff --git a/lib/OperatingSystems/Linux.php b/lib/OperatingSystems/Linux.php index d770fea0..bc886374 100644 --- a/lib/OperatingSystems/Linux.php +++ b/lib/OperatingSystems/Linux.php @@ -130,13 +130,11 @@ public function getUptime(): int { public function getNetworkInfo(): array { $result = [ - 'hostname' => \gethostname(), - 'dns' => '', 'gateway' => '', + 'hostname' => \gethostname(), ]; if (function_exists('shell_exec')) { - $result['dns'] = shell_exec('cat /etc/resolv.conf |grep -i \'^nameserver\'|head -n1|cut -d \' \' -f2'); $result['gateway'] = shell_exec('ip route | awk \'/default/ { print $3 }\''); } diff --git a/templates/settings-admin.php b/templates/settings-admin.php index 4b46e963..5ae2f2b6 100644 --- a/templates/settings-admin.php +++ b/templates/settings-admin.php @@ -180,10 +180,6 @@ function FormatMegabytes(int $byte): string { t('Hostname:')); ?> -
- t('DNS:')); ?> - -
t('Gateway:')); ?>