Browse Source

Quota path is now configurable

tags/1.0.5
Victor Laborie 1 year ago
parent
commit
3495fbb96f
4 changed files with 11 additions and 3 deletions
  1. +3
    -0
      config/config-sample.ini
  2. +6
    -1
      htdocs/lib/Config.php
  3. +1
    -1
      htdocs/lib/LdapAccount.php
  4. +1
    -1
      htdocs/lib/LdapDomain.php

+ 3
- 0
config/config-sample.ini View File

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

+ 6
- 1
htdocs/lib/Config.php View File

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

+ 1
- 1
htdocs/lib/LdapAccount.php View File

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


+ 1
- 1
htdocs/lib/LdapDomain.php View File

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