2006-05-01 08:11:38 +00:00
|
|
|
|
#!/usr/bin/php -q
|
2006-04-26 14:26:21 +00:00
|
|
|
|
<?php
|
|
|
|
|
|
2013-02-18 14:43:55 +00:00
|
|
|
|
require_once("/usr/lib/alternc/panel/class/config_nochk.php");
|
2006-04-26 14:26:21 +00:00
|
|
|
|
// On d<>verrouile le bureau AlternC :)
|
2010-05-11 18:54:28 +00:00
|
|
|
|
@alternc_shutdown();
|
|
|
|
|
|
2006-04-26 14:26:21 +00:00
|
|
|
|
echo "---------------------------\n Generating size-cache for web accounts\n\n";
|
|
|
|
|
$r=mysql_query("SELECT uid,login FROM membres;");
|
|
|
|
|
while ($c=mysql_fetch_array($r)) {
|
|
|
|
|
echo $c["login"]; flush();
|
2013-02-18 14:43:55 +00:00
|
|
|
|
$size=exec("sudo /usr/lib/alternc/du.pl ".ALTERNC_HTML."/".substr($c["login"],0,1)."/".$c["login"]);
|
2006-04-26 14:26:21 +00:00
|
|
|
|
mysql_query("REPLACE INTO size_web SET uid='".$c["uid"]."',size='$size';");
|
|
|
|
|
echo " done ($size KB) \n"; flush();
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-03 08:55:26 +00:00
|
|
|
|
echo "---------------------------\n Generating size-cache for MySQL databases\n\n";
|
|
|
|
|
$r=mysql_query("SELECT uid,db FROM db;");
|
|
|
|
|
while ($c=mysql_fetch_array($r)) {
|
|
|
|
|
echo $c["uid"]."/".$c["db"]; flush();
|
|
|
|
|
$s=mysql_query('SHOW TABLE STATUS FROM `'.$c["db"].'`');
|
|
|
|
|
$size=0;
|
|
|
|
|
while ($d=mysql_fetch_array($s)) {
|
|
|
|
|
$size+=$d["Data_length"]+$d["Index_length"];
|
|
|
|
|
}
|
|
|
|
|
// $size/=1024;
|
|
|
|
|
mysql_query("REPLACE INTO size_db SET db='".$c["db"]."',size='$size';");
|
|
|
|
|
echo " done ($size B) \n"; flush();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
echo "---------------------------\n Generating size-cache for web accounts\n\n";
|
|
|
|
|
$r=@mysql_query("SELECT uid, name FROM mailman;");
|
|
|
|
|
if ($r) {
|
|
|
|
|
while ($c=mysql_fetch_array($r)) {
|
|
|
|
|
echo $c["uid"]."/".$c["name"]; flush();
|
2012-11-27 21:32:43 +00:00
|
|
|
|
$size1=exec("sudo /usr/lib/alternc/du.pl /var/lib/mailman/lists/".$c["name"]);
|
|
|
|
|
$size2=exec("sudo /usr/lib/alternc/du.pl /var/lib/mailman/archives/private/".$c["name"]);
|
|
|
|
|
$size3=exec("sudo /usr/lib/alternc/du.pl /var/lib/mailman/archives/private/".$c["name"].".mbox");
|
2010-06-03 08:55:26 +00:00
|
|
|
|
$size=(intval($size1)+intval($size2)+intval($size3));
|
|
|
|
|
mysql_query("REPLACE INTO size_mailman SET uid='".$c["uid"]."',list='".$c["name"]."', size='$size';");
|
|
|
|
|
echo " done ($size KB) \n"; flush();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-04-26 14:26:21 +00:00
|
|
|
|
// On relocke le bureau pour <20>viter un msg d'erreur.
|
2010-06-03 08:55:26 +00:00
|
|
|
|
@sem_acquire( $alternc_sem );
|
2006-04-26 14:26:21 +00:00
|
|
|
|
|
2006-05-01 08:11:38 +00:00
|
|
|
|
?>
|