Fix PHP warnings on the server status data not set

Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2021-03-31 00:44:34 +02:00
parent b3eeb098a3
commit aa0c22959d
No known key found for this signature in database
GPG Key ID: 90A0EF1B8251A889

View File

@ -54,15 +54,20 @@ class StatusController extends AbstractController
$connections = []; $connections = [];
$replication = ''; $replication = '';
if ($this->data->dataLoaded) { if ($this->data->dataLoaded) {
$networkTraffic = implode( // In some case the data was reported not to exist, check it for all keys
' ', if (isset($this->data->status['Bytes_received'], $this->data->status['Bytes_sent'])) {
Util::formatByteDown( $networkTraffic = implode(
$this->data->status['Bytes_received'] + $this->data->status['Bytes_sent'], ' ',
3, Util::formatByteDown(
1 $this->data->status['Bytes_received'] + $this->data->status['Bytes_sent'],
) 3,
); 1
$uptime = Util::timespanFormat($this->data->status['Uptime']); )
);
}
if (isset($this->data->status['Uptime'])) {
$uptime = Util::timespanFormat($this->data->status['Uptime']);
}
$startTime = Util::localisedDate($this->getStartTime()); $startTime = Util::localisedDate($this->getStartTime());
$traffic = $this->getTrafficInfo(); $traffic = $this->getTrafficInfo();