Quota path is now configurable
This commit is contained in:
parent
f5d9c4738e
commit
3495fbb96f
|
@ -20,3 +20,6 @@ base = "dc=example,dc=com"
|
||||||
admin_dn = "cn=admin,dc=example,dc=com"
|
admin_dn = "cn=admin,dc=example,dc=com"
|
||||||
admin_pass = "xxxxxxx"
|
admin_pass = "xxxxxxx"
|
||||||
superadmin[] = "evoadmin"
|
superadmin[] = "evoadmin"
|
||||||
|
|
||||||
|
[quota]
|
||||||
|
path = "/var/lib/evoadmin-mail/quota/"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class Config {
|
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() {
|
public static function load() {
|
||||||
$file = getenv("EVOADMINMAIL_CONFIG_FILE") or $file = '../config/config.ini';
|
$file = getenv("EVOADMINMAIL_CONFIG_FILE") or $file = '../config/config.ini';
|
||||||
$ini = parse_ini_file($file, true);
|
$ini = parse_ini_file($file, true);
|
||||||
|
@ -9,6 +9,7 @@ class Config {
|
||||||
self::$mail = $ini['global']['mail'];
|
self::$mail = $ini['global']['mail'];
|
||||||
self::$log_level = $ini['global']['log_level'];
|
self::$log_level = $ini['global']['log_level'];
|
||||||
self::$ldap = $ini['ldap'];
|
self::$ldap = $ini['ldap'];
|
||||||
|
self::$quota_path = $ini['quota']['path'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getName() {
|
public static function getName() {
|
||||||
|
@ -42,4 +43,8 @@ class Config {
|
||||||
public static function getSuperadmin() {
|
public static function getSuperadmin() {
|
||||||
return self::$ldap['superadmin'];
|
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->aliases = array_filter($object['mailacceptinggeneralid'], "is_string");
|
||||||
$this->redirections = array_filter($object['maildrop'], "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)) {
|
if (file_exists($quota_file)) {
|
||||||
$short_uid = explode("@", $this->uid)[0];
|
$short_uid = explode("@", $this->uid)[0];
|
||||||
if(preg_match("/^".$short_uid.";([^;]*);(.*)/m", file_get_contents($quota_file), $matches)) {
|
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 (file_exists($quota_file)) {
|
||||||
if(preg_match("/^".$this->domain.";([^;]*);(.*)/m", file_get_contents($quota_file), $matches)) {
|
if(preg_match("/^".$this->domain.";([^;]*);(.*)/m", file_get_contents($quota_file), $matches)) {
|
||||||
$this->quota = $matches[1]." / ".$matches[2];
|
$this->quota = $matches[1]." / ".$matches[2];
|
||||||
|
|
Loading…
Reference in New Issue