Skip to content

Commit 2b7e04f

Browse files
committed
Improved dovecot support.
1 parent feec447 commit 2b7e04f

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

server/plugins-available/mail_plugin.inc.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,14 @@ function user_insert($event_name,$data) {
139139
$app->log("Set ownership on ".escapeshellcmd($data['new']['maildir']),LOGLEVEL_DEBUG);
140140

141141
//* This is to fix the maildrop quota not being rebuilt after the quota is changed.
142-
exec("su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']); // Avoid maildirmake quota bug, see debian bug #214911
143-
$app->log('Created Maildir: '."su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
142+
if($mail_config['pop3_imap_daemon'] != 'dovecot') {
143+
exec("su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']); // Avoid maildirmake quota bug, see debian bug #214911
144+
$app->log('Created Maildir: '."su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
145+
}
144146
}
145147

146148
//* Set the maildir quota
147-
if(is_dir($data['new']['maildir'].'/new')) {
149+
if(is_dir($data['new']['maildir'].'/new') && $mail_config['pop3_imap_daemon'] != 'dovecot') {
148150
exec("su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($data['new']['maildir'])."' ".$mail_config['mailuser_name']);
149151
$app->log('Set Maildir quota: '."su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($data['new']['maildir'])."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
150152
}
@@ -219,8 +221,10 @@ function user_update($event_name,$data) {
219221
exec('chown -R '.$mail_config['mailuser_name'].':'.$mail_config['mailuser_group'].' '.escapeshellcmd($data['new']['maildir']));
220222
$app->log("Set ownership on ".escapeshellcmd($data['new']['maildir']),LOGLEVEL_DEBUG);
221223
//* This is to fix the maildrop quota not being rebuilt after the quota is changed.
222-
exec("su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']); // Avoid maildirmake quota bug, see debian bug #214911
223-
$app->log('Updated Maildir quota: '."su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
224+
if($mail_config['pop3_imap_daemon'] != 'dovecot') {
225+
exec("su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']); // Avoid maildirmake quota bug, see debian bug #214911
226+
$app->log('Updated Maildir quota: '."su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
227+
}
224228
}
225229

226230
// Move mailbox, if domain has changed and delete old mailbox
@@ -237,15 +241,10 @@ function user_update($event_name,$data) {
237241
}
238242
//This is to fix the maildrop quota not being rebuilt after the quota is changed.
239243
// Courier Layout
240-
if(is_dir($data['new']['maildir'].'/new')) {
244+
if(is_dir($data['new']['maildir'].'/new') && $mail_config['pop3_imap_daemon'] != 'dovecot') {
241245
exec("su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($data['new']['maildir'])."' ".$mail_config['mailuser_name']);
242246
$app->log('Updated Maildir quota: '."su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($data['new']['maildir'])."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
243247
}
244-
// Dovecot Layout
245-
if(is_dir($data['new']['maildir'].'/Maildir/new')) {
246-
exec("su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($data['new']['maildir'])."/Maildir' ".$mail_config['mailuser_name']);
247-
$app->log('Updated Maildir quota: '."su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($data['new']['maildir'])."/Maildir' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
248-
}
249248
}
250249

251250
function user_delete($event_name,$data) {

0 commit comments

Comments
 (0)