Skip to content

Commit ed38518

Browse files
committed
postfix-filter requieres postfix reload
1 parent 2813e94 commit ed38518

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

server/plugins-available/postfix_filter_plugin.inc.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ function update($event_name, $data) {
7979
global $app, $conf;
8080

8181
$type = $data["new"]["type"];
82+
$restart = false;
83+
8284
if($type != '') {
8385
$sql = "SELECT * FROM mail_content_filter WHERE server_id = ? AND type = ? AND active = 'y'";
8486
$rules = $app->db->queryAllRecords($sql, $conf["server_id"], $type);
@@ -91,21 +93,25 @@ function update($event_name, $data) {
9193
if($type == 'header') {
9294
file_put_contents('/etc/postfix/header_checks', $content);
9395
$app->log("Writing /etc/postfix/header_checks", LOGLEVEL_DEBUG);
96+
$restart = true;
9497
}
9598

9699
if($type == 'mime_header') {
97100
file_put_contents('/etc/postfix/mime_header_checks', $content);
98101
$app->log("Writing /etc/postfix/mime_header_checks", LOGLEVEL_DEBUG);
102+
$restart = true;
99103
}
100104

101105
if($type == 'nested_header') {
102106
file_put_contents('/etc/postfix/nested_header_checks', $content);
103107
$app->log("Writing /etc/postfix/nested_header_checks", LOGLEVEL_DEBUG);
108+
$restart = true;
104109
}
105110

106111
if($type == 'body') {
107112
file_put_contents('/etc/postfix/body_checks', $content);
108113
$app->log("Writing /etc/postfix/body_checks", LOGLEVEL_DEBUG);
114+
$restart = true;
109115
}
110116
}
111117

@@ -122,23 +128,28 @@ function update($event_name, $data) {
122128
if($type == 'header') {
123129
file_put_contents('/etc/postfix/header_checks', $content);
124130
$app->log("Writing /etc/postfix/header_checks", LOGLEVEL_DEBUG);
131+
$restart = true;
125132
}
126133

127134
if($type == 'mime_header') {
128135
file_put_contents('/etc/postfix/mime_header_checks', $content);
129136
$app->log("Writing /etc/postfix/mime_header_checks", LOGLEVEL_DEBUG);
137+
$restart = true;
130138
}
131139

132140
if($type == 'nested_header') {
133141
file_put_contents('/etc/postfix/nested_header_checks', $content);
134142
$app->log("Writing /etc/postfix/nested_header_checks", LOGLEVEL_DEBUG);
143+
$restart = true;
135144
}
136145

137146
if($type == 'body') {
138147
file_put_contents('/etc/postfix/body_checks', $content);
139148
$app->log("Writing /etc/postfix/body_checks", LOGLEVEL_DEBUG);
149+
$restart = true;
140150
}
141151
}
152+
if($restart) exec('postfix reload');
142153
}
143154

144155
function delete($event_name, $data) {

0 commit comments

Comments
 (0)