Don't compute spaces when quota is disabled

Also fix code ident
This commit is contained in:
Ludovic Poujol 2019-03-21 17:41:11 +01:00
parent 6b1fa94da9
commit 34c7c5dc22

View file

@ -33,9 +33,12 @@ if (!$conf['cluster']) {
foreach($data_output as $data_line) {
$data_split = explode(':', $data_line);
if(isset($conf['quota']) && $conf['quota'] === true) {
if (strstr($data_split[4],'K')) {
$taille_utilise = number_format(($data_split[4]/1024), 2, '.', '').'M';
$taille_utilise_mo = $taille_utilise;
if ($taille_utilise >= 1024) {
$taille_utilise = number_format(($taille_utilise/1024), 2, '.', '').'G';
}
@ -51,6 +54,7 @@ if (!$conf['cluster']) {
$quota_bas = number_format(($data_split[5]/1024), 2, '.', '').'G';
$quota_haut = number_format(($data_split[6]/1024), 2, '.', '').'G';
$occupation = number_format((($taille_utilise_mo/$quota_bas_mo)*100), 2, '.', '');
if ($occupation >= 90) {
$occupation = '<span style="color:red;font-weight:bold;">'.$occupation.'%</span>';
} else if ($occupation >= 80) {
@ -60,6 +64,14 @@ if (!$conf['cluster']) {
} else {
$occupation = $occupation.'%';
}
}
else {
$taille_utilise ="";
$quota_bas = "";
$quota_haut = "";
$occupation = "";
}
array_push($vhost_list, array(
'owner' => $data_split[0],
'configid' => $data_split[1],
@ -73,7 +85,6 @@ if (!$conf['cluster']) {
'is_enabled' => $data_split[8])
);
}
}
else {
@ -98,7 +109,6 @@ else {
if (!empty($accounts)) {
foreach($accounts as $account) {
$master = $bdd->get_server_from_roleid($account['id_master']);
$slave = '';
@ -114,13 +124,10 @@ else {
'master' => $master,
'slave' => $slave)
);
}
}
}
include_once EVOADMIN_BASE . '../tpl/header.tpl.php';
include_once EVOADMIN_BASE . '../tpl/menu.tpl.php';
include_once EVOADMIN_BASE . '../tpl/webadmin.tpl.php';