瀏覽代碼

[Rspamd] 2.5 RC3

andryyy 5 年之前
父節點
當前提交
3e2cbac778
共有 3 個文件被更改,包括 39 次插入10 次删除
  1. 19 8
      data/web/inc/functions.inc.php
  2. 19 1
      data/web/inc/functions.mailbox.inc.php
  3. 1 1
      docker-compose.yml

+ 19 - 8
data/web/inc/functions.inc.php

@@ -1638,20 +1638,31 @@ function solr_status() {
 }
 
 function cleanupJS($ignore = '', $folder = '/tmp/*.js') {
-    foreach (glob($folder) as $filename) {
-        if(strpos($filename, $ignore) !== false) {
-            continue;
-        }
+  $now = time();
+  foreach (glob($folder) as $filename) {
+    if(strpos($filename, $ignore) !== false) {
+      continue;
+    }
+    if (is_file($filename)) {
+      if ($now - filemtime($filename) >= 60 * 60) {
         unlink($filename);
+      }
     }
+  }
 }
 
 function cleanupCSS($ignore = '', $folder = '/tmp/*.css') {
-    foreach (glob($folder) as $filename) {
-        if(strpos($filename, $ignore) !== false) {
-            continue;
-        }
+  $now = time();
+  foreach (glob($folder) as $filename) {
+    if(strpos($filename, $ignore) !== false) {
+      continue;
+    }
+    if (is_file($filename)) {
+      if ($now - filemtime($filename) >= 60 * 60) {
         unlink($filename);
+      }
     }
+  }
 }
+
 ?>

+ 19 - 1
data/web/inc/functions.mailbox.inc.php

@@ -3262,7 +3262,8 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
           if ($last_mail_login === false) {
             $last_mail_login = '';
           }
-          $stmt = $pdo->prepare("SELECT
+          if (preg_match('/y|yes/i', getenv('MASTER'))) {
+            $stmt = $pdo->prepare("SELECT
               `domain`.`backupmx`,
               `mailbox`.`username`,
               `mailbox`.`name`,
@@ -3276,6 +3277,23 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
               `quota2`.`messages`
                 FROM `mailbox`, `quota2`, `domain`
                   WHERE `mailbox`.`kind` NOT REGEXP 'location|thing|group' AND `mailbox`.`username` = `quota2`.`username` AND `domain`.`domain` = `mailbox`.`domain` AND `mailbox`.`username` = :mailbox");
+          }
+          else {
+            $stmt = $pdo->prepare("SELECT
+              `domain`.`backupmx`,
+              `mailbox`.`username`,
+              `mailbox`.`name`,
+              `mailbox`.`active` AS `active_int`,
+              CASE `mailbox`.`active` WHEN 1 THEN '".$lang['mailbox']['yes']."' ELSE '".$lang['mailbox']['no']."' END AS `active`,
+              `mailbox`.`domain`,
+              `mailbox`.`local_part`,
+              `mailbox`.`quota`,
+              `quota2replica`.`bytes`,
+              `attributes`,
+              `quota2replica`.`messages`
+                FROM `mailbox`, `quota2replica`, `domain`
+                  WHERE `mailbox`.`kind` NOT REGEXP 'location|thing|group' AND `mailbox`.`username` = `quota2replica`.`username` AND `domain`.`domain` = `mailbox`.`domain` AND `mailbox`.`username` = :mailbox");
+          }
           $stmt->execute(array(
             ':mailbox' => $_data,
           ));

+ 1 - 1
docker-compose.yml

@@ -71,7 +71,7 @@ services:
             - clamd
 
     rspamd-mailcow:
-      image: mailcow/rspamd:1.65
+      image: mailcow/rspamd:1.66
       stop_grace_period: 30s
       depends_on:
         - nginx-mailcow