Skip to content

Commit 61bdec8

Browse files
committed
Make the thrash filename extra obvious
1 parent 174d70a commit 61bdec8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

server/plugins-available/mail_plugin.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ function user_delete($event_name, $data) {
431431
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) {
432432
if ($mail_config['mailbox_soft_delete'] == 'y') {
433433
// Move it, adding a date based suffix. A cronjob should purge or archive.
434-
$thrash_maildir_path = $old_maildir_path . '-' . date("YmdHis");
434+
$thrash_maildir_path = $old_maildir_path . '-deleted-' . date("YmdHis");
435435
$app->system->exec_safe('mv ? ?', $old_maildir_path, $thrash_maildir_path);
436436

437437
// Update the dir's timestamp to make filtering on age easier in any cleanup cronjob.

server/scripts/handle_mailbox_soft_deleted.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
delay_days=7
55

66
# Test if there is something to do... to avoid 'No such file or directory' from find later.
7-
ls /var/vmail/*/[a-z0-9.-]*-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] >/dev/null 2>&1
7+
ls /var/vmail/*/[a-z0-9.-]*-deleted-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] >/dev/null 2>&1
88
if [ $? != 0 ]; then
99
exit 0;
1010
fi
@@ -36,7 +36,7 @@ echo tar cvfj "$backupfile" --remove-files "$dir" 2> >( grep -v "tar: Removin
3636
# -mtime +7 ===> Only mailboxes deleted more then 7 days ago
3737
# Test that the last dir component matches e.g. xxx-20220101094242 (14 digits)
3838
# command: xxx-`date "+%Y%m%d%H%M%S"`
39-
find /var/vmail/*/[a-z0-9.-]*-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] -maxdepth 0 -type d -mtime +$delay_days | while read line; do
39+
find /var/vmail/*/[a-z0-9.-]*-deleted-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] -maxdepth 0 -type d -mtime +$delay_days | while read line; do
4040
# example $line: "/var/vmail/example.com/info-20220101094242"
4141

4242
dir=$line

0 commit comments

Comments
 (0)