Skip to content

Commit 52bbc89

Browse files
author
Florian Schaal
committed
postfix server-plugin (check your changes before restarting postfix)
1 parent f8bc88f commit 52bbc89

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

server/plugins-available/postfix_server_plugin.inc.php

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -161,27 +161,29 @@ function update($event_name, $data) {
161161
exec('postfix reload');
162162
}
163163

164-
if ($mail_config["mailbox_virtual_uidgid_maps"] == 'y') {
165-
// If dovecot switch to lmtp
166-
if($app->system->is_installed('dovecot')) {
167-
exec("postconf -e 'virtual_transport = lmtp:unix:private/dovecot-lmtp'");
168-
exec('postfix reload');
169-
$app->system->replaceLine("/etc/dovecot/dovecot.conf", "protocols = imap pop3", "protocols = imap pop3 lmtp");
170-
exec($conf['init_scripts'] . '/' . 'dovecot restart');
171-
}
172-
}
173-
else {
174-
// If dovecot switch to dovecot
175-
if($app->system->is_installed('dovecot')) {
176-
exec("postconf -e 'virtual_transport = dovecot'");
177-
exec('postfix reload');
178-
$app->system->replaceLine("/etc/dovecot/dovecot.conf", "protocols = imap pop3 lmtp", "protocols = imap pop3");
179-
exec($conf['init_scripts'] . '/' . 'dovecot restart');
164+
if($app->system->is_installed('dovecot')) {
165+
if ($mail_config["mailbox_virtual_uidgid_maps"] == 'y') {
166+
$temp = exec("postconf -n virtual_transport", $out);
167+
// If dovecot switch to lmtp
168+
if($out[0] != "virtual_transport = lmtp:unix:private/dovecot-lmtp" {
169+
exec("postconf -e 'virtual_transport = lmtp:unix:private/dovecot-lmtp'");
170+
exec('postfix reload');
171+
$app->system->replaceLine("/etc/dovecot/dovecot.conf", "protocols = imap pop3", "protocols = imap pop3 lmtp");
172+
exec($conf['init_scripts'] . '/' . 'dovecot restart');
173+
}
174+
} else {
175+
// If dovecot switch to dovecot
176+
if($out[0] != "virtual_transport = dovecot" {
177+
exec("postconf -e 'virtual_transport = dovecot'");
178+
exec('postfix reload');
179+
$app->system->replaceLine("/etc/dovecot/dovecot.conf", "protocols = imap pop3 lmtp", "protocols = imap pop3");
180+
exec($conf['init_scripts'] . '/' . 'dovecot restart');
180181
}
181182
}
182183

183-
exec("postconf -e 'mailbox_size_limit = ".intval($mail_config['mailbox_size_limit']*1024*1024)."'");
184-
exec("postconf -e 'message_size_limit = ".intval($mail_config['message_size_limit']*1024*1024)."'");
184+
exec("postconf -e 'mailbox_size_limit = ".intval($mail_config['mailbox_size_limit']*1024*1024)."'"); //TODO : no reload?
185+
exec("postconf -e 'message_size_limit = ".intval($mail_config['message_size_limit']*1024*1024)."'"); //TODO : no reload?
186+
185187

186188
}
187189

0 commit comments

Comments
 (0)