finalizing disk usage rework

- changed dockerapi to not return human readable values for df
- all caluclations now in KiB
- moved code from domain_admin to mailbox functions
- using actual occupied bytes as used quota
- all outputs now in *iB using formatBytes()
This commit is contained in:
heavygale
2019-10-01 20:27:06 +02:00
parent 7c2a5ba37e
commit ecda554e53
4 changed files with 28 additions and 36 deletions

View File

@@ -3254,7 +3254,8 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
}
return $resourcedata;
break;
case 'inactive_bytes':
case 'quota_stats':
$quotadata = array();
if ($_SESSION['mailcow_cc_role'] != "admin") {
return false;
}
@@ -3263,9 +3264,13 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
WHERE `mailbox`.`kind` NOT REGEXP 'location|thing|group'
AND `mailbox`.`username` = `quota2`.`username`
AND `domain`.`domain` = `mailbox`.`domain`
AND `domain`.`active` = 0");
AND `domain`.`active` = 1");
$row = $stmt->fetch(PDO::FETCH_ASSOC);
return $row['bytes'];
$quotadata['used_bytes'] = $row['bytes']/1024;
$stmt = $pdo->query("SELECT SUM(`quota`) AS `quota` FROM `domain` WHERE `active`=1");
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$quotadata['total_quota'] = $row['quota']*1024;
return $quotadata;
break;
}
break;