Browse Source

Quota path is now configurable

master 1.0.5
Victor LABORIE 2 years ago
parent
commit
3495fbb96f
  1. 3
      config/config-sample.ini
  2. 7
      htdocs/lib/Config.php
  3. 2
      htdocs/lib/LdapAccount.php
  4. 2
      htdocs/lib/LdapDomain.php

3
config/config-sample.ini

@ -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/"

7
htdocs/lib/Config.php

@ -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;
}
}

2
htdocs/lib/LdapAccount.php

@ -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)) {

2
htdocs/lib/LdapDomain.php

@ -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];

Loading…
Cancel
Save