@@ -429,14 +429,14 @@ function user_delete($event_name, $data) {
429429 $ maildir_path_deleted = false ;
430430 $ old_maildir_path = $ data ['old ' ]['maildir ' ];
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 ) {
432- if ($ mail_config ['mailbox_safe_delete ' ] == 'n ' ) {
433- $ app ->system ->exec_safe ('rm -rf ? ' , $ old_maildir_path );
434- $ app ->log ('Deleted the Maildir: ' .$ data ['old ' ]['maildir ' ], LOGLEVEL_DEBUG );
435- } else {
432+ if ($ mail_config ['mailbox_safe_delete ' ] == 'y ' ) {
436433 // Move it, adding a date based suffix. A cronjob should purge or archive.
437434 $ thrash_maildir_path = $ old_maildir_path . '- ' . date ("YmdHis " );
438435 $ app ->system ->exec_safe ('mv ? ? ' , $ old_maildir_path , $ thrash_maildir_path );
439436 $ app ->log ('Renamed the Maildir: ' . $ data ['old ' ]['maildir ' ] . ' to ' . $ thrash_maildir_path , LOGLEVEL_DEBUG );
437+ } else {
438+ $ app ->system ->exec_safe ('rm -rf ? ' , $ old_maildir_path );
439+ $ app ->log ('Deleted the Maildir: ' .$ data ['old ' ]['maildir ' ], LOGLEVEL_DEBUG );
440440 }
441441 $ maildir_path_deleted = true ;
442442 } else {
@@ -481,13 +481,13 @@ function domain_delete($event_name, $data) {
481481 $ old_maildomain_path = $ mail_config ['homedir_path ' ].'/ ' .$ data ['old ' ]['domain ' ];
482482 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 ' ])) {
483483 if ($ mail_config ['mailbox_safe_delete ' ] == 'n ' ) {
484- $ app ->system ->exec_safe ('rm -rf ? ' , $ old_maildomain_path );
485- $ app ->log ('Deleted the mail domain directory: ' .$ old_maildomain_path , LOGLEVEL_DEBUG );
486- } else {
487484 // Move it, adding a date based suffix. A cronjob should purge or archive.
488485 $ thrash_maildomain_path = $ old_maildomain_path . '- ' . date ("YmdHis " );
489486 $ app ->system ->exec_safe ('mv ? ? ' , $ old_maildomain_path , $ thrash_maildomain_path );
490487 $ app ->log ('Renamed the mail domain directory: ' . $ old_maildomain_path . ' to ' . $ thrash_maildomain_path , LOGLEVEL_DEBUG );
488+ } else {
489+ $ app ->system ->exec_safe ('rm -rf ? ' , $ old_maildomain_path );
490+ $ app ->log ('Deleted the mail domain directory: ' .$ old_maildomain_path , LOGLEVEL_DEBUG );
491491 }
492492 $ maildomain_path_deleted = true ;
493493 } else {
0 commit comments