Skip to content
Snippets Groups Projects
Commit fe9b73c3 authored by Marius Cramer's avatar Marius Cramer
Browse files

Merge branch 'master' into 'master'

Master



See merge request !244
parents 26e265ea f562971d
No related branches found
No related tags found
No related merge requests found
...@@ -198,14 +198,19 @@ class cronjob_backup_mail extends cronjob { ...@@ -198,14 +198,19 @@ class cronjob_backup_mail extends cronjob {
/* remove archives */ /* remove archives */
$mail_backup_dir = realpath($backup_dir.'/mail'.$domain_rec['domain_id']); $mail_backup_dir = realpath($backup_dir.'/mail'.$domain_rec['domain_id']);
$mail_backup_file = 'mail'.$rec['mailuser_id'].'_*'; $mail_backup_file = 'mail'.$rec['mailuser_id'].'_';
if(is_dir($mail_backup_dir)) { if(is_dir($mail_backup_dir)) {
$dir_handle = opendir($mail_backup_dir.'/'); $dir_handle = opendir($mail_backup_dir.'/');
while ($file = readdir($dir_handle)) { while ($file = readdir($dir_handle)) {
if(!is_dir($file)) { if(!is_dir($file)) {
unlink ("$mail_backup_dir/"."$file"); if(substr($file,0,strlen($mail_backup_file)) == $mail_backup_file) {
unlink ($mail_backup_dir.'/'.$file);
}
} }
} }
if(count(glob($mail_backup_dir."/*", GLOB_NOSORT)) === 0) {
rmdir($mail_backup_dir);
}
} }
/* remove backups from db */ /* remove backups from db */
$sql = "DELETE FROM mail_backup WHERE server_id = ? AND parent_domain_id = ? AND mailuser_id = ?"; $sql = "DELETE FROM mail_backup WHERE server_id = ? AND parent_domain_id = ? AND mailuser_id = ?";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment