[fix] spoolsize du should be in summary mode

This commit is contained in:
alban 2017-10-08 10:41:56 +02:00
parent 594db5d8b5
commit 71af846c11
1 changed files with 4 additions and 4 deletions

View File

@ -22,7 +22,7 @@ if ($db->query("SELECT uid,login FROM membres;")) {
} else { } else {
// The QUOTA system being disabled, we need to use 'du' on each folder. // The QUOTA system being disabled, we need to use 'du' on each folder.
$login = $db->f('login'); $login = $db->f('login');
$size=exec("/usr/bin/du /var/www/alternc/".substr($login,0,1)."/".$login); $size=exec("/usr/bin/du -s /var/www/alternc/".substr($login,0,1)."/".$login);
} }
$db2->query("REPLACE INTO size_web SET uid=?, size=?;",array(intval($db->f('uid')),intval($size))); $db2->query("REPLACE INTO size_web SET uid=?, size=?;",array(intval($db->f('uid')),intval($size)));
echo $db->f('login')." (".(round($size/1024, 1))." MB)\n"; echo $db->f('login')." (".(round($size/1024, 1))." MB)\n";
@ -58,9 +58,9 @@ if ($db->query("SELECT uid, name FROM mailman;")) {
} }
foreach ($cc as $c){ foreach ($cc as $c){
echo $c["uid"]."/".$c["name"]; flush(); echo $c["uid"]."/".$c["name"]; flush();
$size1=exec("sudo /usr/bin/du ".escapeshellarg("/var/lib/mailman/lists/".$c["name"])); $size1=exec("sudo /usr/bin/du -s ".escapeshellarg("/var/lib/mailman/lists/".$c["name"]));
$size2=exec("sudo /usr/bin/du ".escapeshellarg("/var/lib/mailman/archives/private/".$c["name"])); $size2=exec("sudo /usr/bin/du -s ".escapeshellarg("/var/lib/mailman/archives/private/".$c["name"]));
$size3=exec("sudo /usr/bin/du ".escapeshellarg("/var/lib/mailman/archives/private/".$c["name"].".mbox")); $size3=exec("sudo /usr/bin/du -s ".escapeshellarg("/var/lib/mailman/archives/private/".$c["name"].".mbox"));
$size=(intval($size1)+intval($size2)+intval($size3)); $size=(intval($size1)+intval($size2)+intval($size3));
$db->query("REPLACE INTO size_mailman SET uid=?,list=?,size=?;",array($c["uid"],$c["name"],$size)); $db->query("REPLACE INTO size_mailman SET uid=?,list=?,size=?;",array($c["uid"],$c["name"],$size));
echo " done (".(round($size/1024, 1))." MB) \n"; flush(); echo " done (".(round($size/1024, 1))." MB) \n"; flush();