diff --git a/install/tpl/server.ini.master b/install/tpl/server.ini.master index bf2e28007de965c48bd25ef1cc335398440d7956..37054010d44fa16647266efc3b8949ed8888424f 100644 --- a/install/tpl/server.ini.master +++ b/install/tpl/server.ini.master @@ -52,7 +52,7 @@ relayhost_user= relayhost_password= mailbox_size_limit=0 message_size_limit=0 -mailbox_safe_delete=y +mailbox_safe_delete=n mailbox_quota_stats=y realtime_blackhole_list=zen.spamhaus.org overquota_notify_admin=y diff --git a/server/plugins-available/mail_plugin.inc.php b/server/plugins-available/mail_plugin.inc.php index c4f496b9c91b395451d6f470dd345bd50eea5dd0..cf6c9b5fb5448ce5b011404a68f5abbb70e71be4 100644 --- a/server/plugins-available/mail_plugin.inc.php +++ b/server/plugins-available/mail_plugin.inc.php @@ -429,14 +429,14 @@ class mail_plugin { $maildir_path_deleted = false; $old_maildir_path = $data['old']['maildir']; if($old_maildir_path != $mail_config['homedir_path'] && strlen($old_maildir_path) > strlen($mail_config['homedir_path']) && !stristr($old_maildir_path, '//') && !stristr($old_maildir_path, '..') && !stristr($old_maildir_path, '*') && strlen($old_maildir_path) >= 10) { - if ($mail_config['mailbox_safe_delete'] == 'n') { - $app->system->exec_safe('rm -rf ?', $old_maildir_path); - $app->log('Deleted the Maildir: '.$data['old']['maildir'], LOGLEVEL_DEBUG); - } else { + if ($mail_config['mailbox_safe_delete'] == 'y') { // Move it, adding a date based suffix. A cronjob should purge or archive. $thrash_maildir_path = $old_maildir_path . '-' . date("YmdHis"); $app->system->exec_safe('mv ? ?', $old_maildir_path, $thrash_maildir_path); $app->log('Renamed the Maildir: ' . $data['old']['maildir'] . ' to ' . $thrash_maildir_path, LOGLEVEL_DEBUG); + } else { + $app->system->exec_safe('rm -rf ?', $old_maildir_path); + $app->log('Deleted the Maildir: '.$data['old']['maildir'], LOGLEVEL_DEBUG); } $maildir_path_deleted = true; } else { @@ -481,13 +481,13 @@ class mail_plugin { $old_maildomain_path = $mail_config['homedir_path'].'/'.$data['old']['domain']; if($old_maildomain_path != $mail_config['homedir_path'] && !stristr($old_maildomain_path, '//') && !stristr($old_maildomain_path, '..') && !stristr($old_maildomain_path, '*') && !stristr($old_maildomain_path, '&') && strlen($old_maildomain_path) >= 10 && !empty($data['old']['domain'])) { if ($mail_config['mailbox_safe_delete'] == 'n') { - $app->system->exec_safe('rm -rf ?', $old_maildomain_path); - $app->log('Deleted the mail domain directory: '.$old_maildomain_path, LOGLEVEL_DEBUG); - } else { // Move it, adding a date based suffix. A cronjob should purge or archive. $thrash_maildomain_path = $old_maildomain_path . '-' . date("YmdHis"); $app->system->exec_safe('mv ? ?', $old_maildomain_path, $thrash_maildomain_path); $app->log('Renamed the mail domain directory: ' . $old_maildomain_path . ' to ' . $thrash_maildomain_path, LOGLEVEL_DEBUG); + } else { + $app->system->exec_safe('rm -rf ?', $old_maildomain_path); + $app->log('Deleted the mail domain directory: '.$old_maildomain_path, LOGLEVEL_DEBUG); } $maildomain_path_deleted = true; } else {