From aa0c22959d2826308bc0eebfae15e1f1796b901d Mon Sep 17 00:00:00 2001 From: William Desportes Date: Wed, 31 Mar 2021 00:44:34 +0200 Subject: [PATCH] Fix PHP warnings on the server status data not set Signed-off-by: William Desportes --- .../Server/Status/StatusController.php | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/libraries/classes/Controllers/Server/Status/StatusController.php b/libraries/classes/Controllers/Server/Status/StatusController.php index 61554a54b1..0fa1cc72ef 100644 --- a/libraries/classes/Controllers/Server/Status/StatusController.php +++ b/libraries/classes/Controllers/Server/Status/StatusController.php @@ -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();