fixing quota issues since big patch earlier

This commit is contained in:
Benjamin Sonntag 2012-08-25 20:43:28 +00:00
parent 33c13635a4
commit 78d57820e5
3 changed files with 14 additions and 25 deletions

View File

@ -30,10 +30,6 @@ define('SLAVE_FLAG', "/var/run/alternc/refresh_slave");
* *
* Cette classe permet de gérer les domaines / sous-domaines, redirections * Cette classe permet de gérer les domaines / sous-domaines, redirections
* dns et mx des domaines d'un membre hébergé.<br /> * dns et mx des domaines d'un membre hébergé.<br />
* Copyleft {@link http://alternc.net/ AlternC Team}
*
* @copyright AlternC-Team 2002-11-01 http://alternc.net/
*
*/ */
class m_dom { class m_dom {
@ -93,8 +89,8 @@ class m_dom {
/** /**
* Quota name * Quota name
*/ */
function alternc_quota_names() { function hook_quota_names() {
return "dom"; return array("dom"=>_("Domain name"));
} }
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
@ -1359,5 +1355,3 @@ class m_dom {
} /* Class m_domains */ } /* Class m_domains */
?>

View File

@ -67,10 +67,10 @@ class m_mail {
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
/** Quota list (hook for quota class) /** Quota list (hook for quota class, returns an array of hashes)
*/ */
function hook_quota_names() { function hook_quota_names() {
return "mail"; return array("mail"=>_("Email addresses"));
} }
@ -583,4 +583,3 @@ class m_mail {
} /* Class m_mail */ } /* Class m_mail */
?>

View File

@ -91,23 +91,18 @@ class m_quota {
} }
} }
} }
// New Hook
$qname=$hooks->invoke("hook_quota_names"); // return strings or arrays $qname=$hooks->invoke("hook_quota_names"); // return strings or arrays
foreach($qname as $res) foreach($qname as $res)
if ($res) { if ($res && is_array($res)) {
if (is_array($res)) { foreach($res as $k=>$v) {
foreach($res as $k) { $qlist[$k]=$v;
$qlist[$k]=_("quota_".$k); $this->clquota[$k]=$k;
$this->clquota[$k]=$c;
}
} else {
$qlist[$res]=_("quota_".$res);
$this->clquota[$res]=$c;
} }
} }
return $qlist; return $qlist;
} }
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
/** Return a ressource usage (u) and total quota (t) /** Return a ressource usage (u) and total quota (t)
@ -140,11 +135,12 @@ class m_quota {
); );
} }
} }
// New Hook :
foreach ($ttmp as $tt) { foreach ($ttmp as $tt) {
$res=$hooks->invoke("",$tt["name"]); $res=$hooks->invoke("hook_quota_get",array($tt["name"]));
foreach($res as $r) { foreach($res as $r) {
if ($r) { if ($r!==false) {
$this->quotas[$tt["name"]]=array("t"=>$tt["total"],"u"); $this->quotas[$tt["name"]]=array("t"=>$tt["total"],"u"=>$r);
} }
} }
} }