File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
server/lib/classes/cron.d Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -198,14 +198,19 @@ public function onRunJob() {
198198
199199 /* remove archives */
200200 $ mail_backup_dir = realpath ($ backup_dir .'/mail ' .$ domain_rec ['domain_id ' ]);
201- $ mail_backup_file = 'mail ' .$ rec ['mailuser_id ' ].'_* ' ;
201+ $ mail_backup_file = 'mail ' .$ rec ['mailuser_id ' ].'_ ' ;
202202 if (is_dir ($ mail_backup_dir )) {
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 = ? " ;
You can’t perform that action at this time.
0 commit comments