correctly calculate traffic usage and output bytes in Traffic-Api-Command instead of KB

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-11-04 18:02:04 +01:00
parent 338eca4eb6
commit d16608c94a
3 changed files with 12 additions and 5 deletions

View File

@@ -159,6 +159,11 @@ class Traffic extends ApiCommand implements ResourceEntity
}
Database::pexecute($result_stmt, $params, true, true);
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
// make Bytes from KB
$row['http'] *= 1024;
$row['ftp_up'] *= 1024;
$row['ftp_down'] *= 1024;
$row['mail'] *= 1024;
$result[] = $row;
}
$this->logger()->logAction($this->isAdmin() ? FroxlorLogger::ADM_ACTION : FroxlorLogger::USR_ACTION, LOG_NOTICE, "[API] list traffic");