Skip to content

Commit 85fdab1

Browse files
author
Marius Cramer
committed
Merge branch 'master' into 'master'
Master See merge request !243
2 parents b717d29 + 798c41a commit 85fdab1

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

server/plugins-available/postfix_server_plugin.inc.php

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -161,27 +161,30 @@ 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+
$temp = exec("postconf -n virtual_transport", $out);
166+
if ($mail_config["mailbox_virtual_uidgid_maps"] == 'y') {
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');
181+
}
180182
}
181183
}
182184

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)."'");
185+
exec("postconf -e 'mailbox_size_limit = ".intval($mail_config['mailbox_size_limit']*1024*1024)."'"); //TODO : no reload?
186+
exec("postconf -e 'message_size_limit = ".intval($mail_config['message_size_limit']*1024*1024)."'"); //TODO : no reload?
187+
185188

186189
}
187190

0 commit comments

Comments
 (0)