1
0
mirror of https://github.com/billz/raspap-webgui.git synced 2023-10-10 13:37:24 +02:00

Bugfix: vnstat column name change

This commit is contained in:
billz 2021-11-18 10:26:38 +00:00
parent c0774a7bde
commit 4b27f9c844

View File

@ -34,16 +34,13 @@ if (filter_input(INPUT_GET, 'tu') == 'h') {
23 => array('date' => '23:00', 'rx' => 0, 'tx' => 0) 23 => array('date' => '23:00', 'rx' => 0, 'tx' => 0)
); );
exec(sprintf('vnstat -i %s --json h', escapeshellarg($interface)), $jsonstdoutvnstat, $exitcodedaily); exec(sprintf('vnstat -i %s --json h', escapeshellarg($interface)), $jsonstdoutvnstat, $exitcodedaily);
if ($exitcodedaily !== 0) { if ($exitcodedaily !== 0) {
exit('vnstat error'); exit('vnstat error');
} }
$jsonobj = json_decode($jsonstdoutvnstat[0], true)['interfaces'][0]; $jsonobj = json_decode($jsonstdoutvnstat[0], true)['interfaces'][0];
$jsonData = $jsonobj['traffic']['hours']; $jsonData = $jsonobj['traffic']['hour'];
for ($i = count($jsonData) - 1; $i >= 0; --$i) { for ($i = count($jsonData) - 1; $i >= 0; --$i) {
$data_template[$jsonData[$i]['id']]['rx'] = round($jsonData[$i]['rx'] / 1024, 0); $data_template[$jsonData[$i]['id']]['rx'] = round($jsonData[$i]['rx'] / 1024, 0);
$data_template[$jsonData[$i]['id']]['tx'] = round($jsonData[$i]['tx'] / 1024, 0); $data_template[$jsonData[$i]['id']]['tx'] = round($jsonData[$i]['tx'] / 1024, 0);