Communicate to user if db backup files could not be deleted (#7872)

This commit is contained in:
schasi 2025-07-17 16:13:38 +02:00 committed by GitHub
parent 9a2b3a4a92
commit e32dbaeb31
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -90,8 +90,15 @@ public class AutomaticDatabaseExportWorker extends Worker {
}
}
Collections.sort(files, (o1, o2) -> Long.compare(o2.lastModified(), o1.lastModified()));
boolean hasDeletionFailed = false;
for (int i = 5; i < files.size(); i++) {
files.get(i).delete();
boolean isDeleted = files.get(i).delete();
if (!hasDeletionFailed && !isDeleted) {
hasDeletionFailed = true;
}
}
if (hasDeletionFailed) {
throw new IOException("Unable to delete some database backup files");
}
}