Browse Source

Quota path is now configurable

tags/1.0.5
Victor Laborie 3 months 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"
20 20
 admin_dn = "cn=admin,dc=example,dc=com"
21 21
 admin_pass = "xxxxxxx"
22 22
 superadmin[] = "evoadmin"
23
+
24
+[quota]
25
+path = "/var/lib/evoadmin-mail/quota/"

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

@@ -1,7 +1,7 @@
1 1
 <?php
2 2
 
3 3
 class Config {
4
-    private static $name='Evoadmin Mail', $mail='root@localhost', $log_level='error', $ldap=array();
4
+    private static $name='Evoadmin Mail', $mail='root@localhost', $log_level='error', $ldap=array(), $quota_path='';
5 5
     public static function load() {
6 6
         $file = getenv("EVOADMINMAIL_CONFIG_FILE") or $file = '../config/config.ini';
7 7
         $ini = parse_ini_file($file, true);
@@ -9,6 +9,7 @@ class Config {
9 9
         self::$mail = $ini['global']['mail'];
10 10
         self::$log_level = $ini['global']['log_level'];
11 11
         self::$ldap = $ini['ldap'];
12
+        self::$quota_path = $ini['quota']['path'];
12 13
     }
13 14
 
14 15
     public static function getName() {
@@ -42,4 +43,8 @@ class Config {
42 43
     public static function getSuperadmin() {
43 44
         return self::$ldap['superadmin'];
44 45
     }
46
+
47
+    public static function getQuotaPath() {
48
+        return self::$quota_path;
49
+    }
45 50
 }

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

@@ -24,7 +24,7 @@ class LdapAccount extends LdapDomain {
24 24
             $this->aliases = array_filter($object['mailacceptinggeneralid'], "is_string");
25 25
             $this->redirections = array_filter($object['maildrop'], "is_string");
26 26
 
27
-            $quota_file = '/home/evoadmin-mail/quota/'.$this->domain->domain.'.csv';
27
+            $quota_file = Config::getQuotaPath().$this->domain->domain.'.csv';
28 28
             if (file_exists($quota_file)) {
29 29
                 $short_uid = explode("@", $this->uid)[0];
30 30
                 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 {
35 35
                     }
36 36
                 }
37 37
             }
38
-            $quota_file = '/home/evoadmin-mail/quota/all.csv';
38
+            $quota_file = Config::getQuotaPath().'all.csv';
39 39
             if (file_exists($quota_file)) {
40 40
                 if(preg_match("/^".$this->domain.";([^;]*);(.*)/m", file_get_contents($quota_file), $matches)) {
41 41
 			$this->quota = $matches[1]." / ".$matches[2];

Loading…
Cancel
Save