Bugfixes pour la gestion des quotas diques

This commit is contained in:
Steven Mondji-Lerider 2012-06-12 17:14:16 +00:00
parent 0bba178de7
commit 383f1a291d
5 changed files with 12 additions and 11 deletions

View File

@ -280,10 +280,12 @@ if ($sd) echo "&nbsp;&nbsp;&nbsp;-&nbsp;".$d["domaine"]."<br />\n";
// Espace WEB
list($ws)=@mysql_fetch_array(mysql_query("SELECT size FROM size_web WHERE uid='".$c["uid"]."';"));
if ($totalweb)
if (isset($totalweb) && $totalweb){
$pc=intval(100*$ws/$totalweb);
else
}
else{
$pc=0;
}
if ($mode==0) {
echo sprintf("%.1f", $ws / 1024)."&nbsp;"._("MB");

View File

@ -181,10 +181,8 @@ class m_quota {
if (isset($this->disk[$ressource])) {
// It's a disk resource, update it with shell command
exec("/usr/lib/alternc/quota_edit $cuid $size");
echo "quota set :::::ciud: $cuid :::: size: $size :::: \n ";
// Now we check that the value has been written properly :
exec("/usr/lib/alternc/quota_get ".$cuid,$a);
print_r($a);
exec("usr/lib/alternc/quota_get $cuid",$a);
if ($size!=$a[1]) {
$err->raise("quota",1);
return false;

View File

@ -327,6 +327,7 @@ CREATE TABLE IF NOT EXISTS defquotas (
# Ces quotas par defaut sont redefinissables dans l`interface web
INSERT IGNORE INTO defquotas (quota,value) VALUES ('dom',1);
INSERT IGNORE INTO defquotas (quota,value) VALUES ('web',51200);
INSERT IGNORE INTO defquotas (quota,value) VALUES ('mail',10);
INSERT IGNORE INTO defquotas (quota,value) VALUES ('ftp',2);
INSERT IGNORE INTO defquotas (quota,value) VALUES ('stats',1);

View File

@ -52,8 +52,8 @@ if (mysql_errno()) {
}
while ($c=mysql_fetch_array($r)) {
$s=mysql_query("SELECT name FROM quotas WHERE uid='$c[uid]' AND name='$name';");
if (!mysql_num_rows($s)) {
mysql_query("INSERT INTO quotas (uid,name,total) VALUES ('$c[uid]','$name','$quota');");
if (mysql_num_rows($s)) {
mysql_query("INSERT INTO quotas (uid,name,total) VALUES ('$c[uid]','$name','$quota') on DUPLICATE KEY UPDATE total=$quota;");
}
}

View File

@ -6,11 +6,11 @@ require_once("/var/alternc/bureau/class/config_nochk.php");
@alternc_shutdown();
echo "---------------------------\n Generating size-cache for mail accounts\n\n";
$r=mysql_query("SELECT * FROM mail_users WHERE alias NOT LIKE '%@%' AND alias LIKE '%\_%';");
$r=mysql_query("SELECT * FROM dovecot_view ;");
while ($c=mysql_fetch_array($r)) {
echo $c["alias"]; flush();
$size=exec("/usr/lib/alternc/du.pl ".$c["path"]);
mysql_query("REPLACE INTO size_mail SET alias='".addslashes($c["alias"])."',size='$size';");
echo $c["user"]; flush();
$size=exec("/usr/lib/alternc/du.pl ".$c["userdb_home"]);
mysql_query("REPLACE INTO size_mail SET alias='".addslashes($c["user"])."',size='$size';");
echo " done ($size KB)\n"; flush();
}