Add support for quota information

This commit is contained in:
Victor LABORIE 2018-11-12 13:52:52 +01:00
parent 73a434dfd2
commit a9cdb71630
2 changed files with 15 additions and 2 deletions

View file

@ -21,9 +21,17 @@ class LdapAccount extends LdapDomain {
$this->courier = ($object['courieractive'][0] == 'TRUE') ? true : false;
$this->webmail = ($object['webmailactive'][0] == 'TRUE') ? true : false;
$this->authsmtp = ($object['authsmtpactive'][0] == 'TRUE') ? true : false;
//$this->quota = getquota($this->domain->getName(),'user');
$this->aliases = array_filter($object['mailacceptinggeneralid'], "is_string");
$this->redirections = array_filter($object['maildrop'], "is_string");
$quota_file = '/home/evoadmin-mail/quota/'.$this->domain->domain.'.csv';
if (file_exists($quota_file)) {
$short_uid = explode("@", $this->uid)[0];
if(preg_match("/^".$short_uid.";([^;]*);(.*)/m", file_get_contents($quota_file), $matches)) {
$this->quota = $matches[1]." / ".$matches[2];
}
}
} else {
throw new Exception("Ce compte n'existe pas !");
}

View file

@ -35,7 +35,12 @@ class LdapDomain extends LdapServer {
}
}
}
//$this->quota = getquota($this->domain,'group');
$quota_file = '/home/evoadmin-mail/quota/all.csv';
if (file_exists($quota_file)) {
if(preg_match("/^".$this->domain.";([^;]*);(.*)/m", file_get_contents($quota_file), $matches)) {
$this->quota = $matches[1]." / ".$matches[2];
}
}
} else {
throw new Exception("Ce domaine n'existe pas !");
}