Quota path is now configurable
Cette révision appartient à :
Parent
f5d9c4738e
révision
3495fbb96f
|
@ -20,3 +20,6 @@ base = "dc=example,dc=com"
|
|||
admin_dn = "cn=admin,dc=example,dc=com"
|
||||
admin_pass = "xxxxxxx"
|
||||
superadmin[] = "evoadmin"
|
||||
|
||||
[quota]
|
||||
path = "/var/lib/evoadmin-mail/quota/"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
class Config {
|
||||
private static $name='Evoadmin Mail', $mail='root@localhost', $log_level='error', $ldap=array();
|
||||
private static $name='Evoadmin Mail', $mail='root@localhost', $log_level='error', $ldap=array(), $quota_path='';
|
||||
public static function load() {
|
||||
$file = getenv("EVOADMINMAIL_CONFIG_FILE") or $file = '../config/config.ini';
|
||||
$ini = parse_ini_file($file, true);
|
||||
|
@ -9,6 +9,7 @@ class Config {
|
|||
self::$mail = $ini['global']['mail'];
|
||||
self::$log_level = $ini['global']['log_level'];
|
||||
self::$ldap = $ini['ldap'];
|
||||
self::$quota_path = $ini['quota']['path'];
|
||||
}
|
||||
|
||||
public static function getName() {
|
||||
|
@ -42,4 +43,8 @@ class Config {
|
|||
public static function getSuperadmin() {
|
||||
return self::$ldap['superadmin'];
|
||||
}
|
||||
|
||||
public static function getQuotaPath() {
|
||||
return self::$quota_path;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ class LdapAccount extends LdapDomain {
|
|||
$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';
|
||||
$quota_file = Config::getQuotaPath().$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)) {
|
||||
|
|
|
@ -35,7 +35,7 @@ class LdapDomain extends LdapServer {
|
|||
}
|
||||
}
|
||||
}
|
||||
$quota_file = '/home/evoadmin-mail/quota/all.csv';
|
||||
$quota_file = Config::getQuotaPath().'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];
|
||||
|
|
Chargement…
Référencer dans un nouveau ticket