From ed38518a8516387335869e63b50de6010e181e7e Mon Sep 17 00:00:00 2001
From: Florian Schaal <info@schaal-24.de>
Date: Wed, 1 Feb 2017 11:26:30 +0100
Subject: [PATCH] postfix-filter requieres postfix reload

---
 .../plugins-available/postfix_filter_plugin.inc.php   | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/server/plugins-available/postfix_filter_plugin.inc.php b/server/plugins-available/postfix_filter_plugin.inc.php
index b8b910b64c..cbecf7ddf2 100644
--- a/server/plugins-available/postfix_filter_plugin.inc.php
+++ b/server/plugins-available/postfix_filter_plugin.inc.php
@@ -79,6 +79,8 @@ class postfix_filter_plugin {
 		global $app, $conf;
 
 		$type = $data["new"]["type"];
+		$restart = false;
+
 		if($type != '') {
 			$sql = "SELECT * FROM mail_content_filter WHERE server_id = ? AND type = ? AND active = 'y'";
 			$rules = $app->db->queryAllRecords($sql, $conf["server_id"], $type);
@@ -91,21 +93,25 @@ class postfix_filter_plugin {
 			if($type == 'header') {
 				file_put_contents('/etc/postfix/header_checks', $content);
 				$app->log("Writing /etc/postfix/header_checks", LOGLEVEL_DEBUG);
+				$restart = true;
 			}
 
 			if($type == 'mime_header') {
 				file_put_contents('/etc/postfix/mime_header_checks', $content);
 				$app->log("Writing /etc/postfix/mime_header_checks", LOGLEVEL_DEBUG);
+				$restart = true;
 			}
 
 			if($type == 'nested_header') {
 				file_put_contents('/etc/postfix/nested_header_checks', $content);
 				$app->log("Writing /etc/postfix/nested_header_checks", LOGLEVEL_DEBUG);
+				$restart = true;
 			}
 
 			if($type == 'body') {
 				file_put_contents('/etc/postfix/body_checks', $content);
 				$app->log("Writing /etc/postfix/body_checks", LOGLEVEL_DEBUG);
+				$restart = true;
 			}
 		}
 
@@ -122,23 +128,28 @@ class postfix_filter_plugin {
 			if($type == 'header') {
 				file_put_contents('/etc/postfix/header_checks', $content);
 				$app->log("Writing /etc/postfix/header_checks", LOGLEVEL_DEBUG);
+				$restart = true;
 			}
 
 			if($type == 'mime_header') {
 				file_put_contents('/etc/postfix/mime_header_checks', $content);
 				$app->log("Writing /etc/postfix/mime_header_checks", LOGLEVEL_DEBUG);
+				$restart = true;
 			}
 
 			if($type == 'nested_header') {
 				file_put_contents('/etc/postfix/nested_header_checks', $content);
 				$app->log("Writing /etc/postfix/nested_header_checks", LOGLEVEL_DEBUG);
+				$restart = true;
 			}
 
 			if($type == 'body') {
 				file_put_contents('/etc/postfix/body_checks', $content);
 				$app->log("Writing /etc/postfix/body_checks", LOGLEVEL_DEBUG);
+				$restart = true;
 			}
 		}
+		if($restart) exec('postfix reload');
 	}
 
 	function delete($event_name, $data) {
-- 
GitLab