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 = [];
$replication = '';
if ($this->data->dataLoaded) {
$networkTraffic = implode(
' ',
Util::formatByteDown(
$this->data->status['Bytes_received'] + $this->data->status['Bytes_sent'],
3,
1
)
);
$uptime = Util::timespanFormat($this->data->status['Uptime']);
// 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'])) {
$networkTraffic = implode(
' ',
Util::formatByteDown(
$this->data->status['Bytes_received'] + $this->data->status['Bytes_sent'],
3,
1
)
);
}
if (isset($this->data->status['Uptime'])) {
$uptime = Util::timespanFormat($this->data->status['Uptime']);
}
$startTime = Util::localisedDate($this->getStartTime());
$traffic = $this->getTrafficInfo();