Skip to content

Commit ef5c451

Browse files
author
Florian Schaal
committed
fixed remove inactive mail-backups
1 parent 26e265e commit ef5c451

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

server/lib/classes/cron.d/500-backup_mail.inc.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,14 @@ public function onRunJob() {
203203
$dir_handle = opendir($mail_backup_dir.'/');
204204
while ($file = readdir($dir_handle)) {
205205
if(!is_dir($file)) {
206-
unlink ("$mail_backup_dir/"."$file");
206+
if(substr($file,0,strlen($mail_backup_file)) == $mail_backup_file) {
207+
unlink ($mail_backup_dir.'/'.$file);
208+
}
207209
}
208210
}
211+
if(count(glob($mail_backup_dir."/*", GLOB_NOSORT)) === 0) {
212+
rmdir($mail_backup_dir);
213+
}
209214
}
210215
/* remove backups from db */
211216
$sql = "DELETE FROM mail_backup WHERE server_id = ? AND parent_domain_id = ? AND mailuser_id = ?";

0 commit comments

Comments
 (0)