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,6 +54,8 @@ class StatusController extends AbstractController
$connections = []; $connections = [];
$replication = ''; $replication = '';
if ($this->data->dataLoaded) { if ($this->data->dataLoaded) {
// 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( $networkTraffic = implode(
' ', ' ',
Util::formatByteDown( Util::formatByteDown(
@ -62,7 +64,10 @@ class StatusController extends AbstractController
1 1
) )
); );
}
if (isset($this->data->status['Uptime'])) {
$uptime = Util::timespanFormat($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();