Browse Source

Forwarding hosts: don’t add configuration if none are defined

Michael Kuron 8 năm trước cách đây
mục cha
commit
affa52edcf
1 tập tin đã thay đổi với 7 bổ sung2 xóa
  1. 7 2
      data/conf/rspamd/dynmaps/settings.php

+ 7 - 2
data/conf/rspamd/dynmaps/settings.php

@@ -31,8 +31,6 @@ catch (PDOException $e) {
 
 ?>
 settings {
-	whitelist_forwarding_hosts {
-		priority = high;
 <?php
 try {
 	$stmt = $pdo->query("SELECT `host` FROM `forwarding_hosts`");
@@ -42,6 +40,12 @@ catch (PDOException $e) {
 	$rows = array();
 }
 
+if ($rows)
+{
+?>
+	whitelist_forwarding_hosts {
+		priority = high;
+<?php
 foreach ($rows as $host) {
 	echo "\t\t" . 'ip = "' . $host . '";' . "\n";
 }
@@ -56,6 +60,7 @@ foreach ($rows as $host) {
 		]
 	}
 <?php
+}
 $stmt = $pdo->query("SELECT DISTINCT `object` FROM `filterconf` WHERE `option` = 'highspamlevel' OR `option` = 'lowspamlevel'");
 $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);