Skip to content

Commit

Permalink
Add some temporary debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
HeatherComputer authored Jul 18, 2024
1 parent 792da60 commit c3e247b
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@ public static void makeSnapshot(Consumer<String> output) {
public static void finishBackup(boolean snapshot) {

ABCore.resetActivity();

System.out.println("Snapshot : " + snapshot);

if (snapshot) return;

Expand All @@ -360,6 +362,8 @@ public static void finishBackup(boolean snapshot) {

}

System.out.println("Beginning purge checks : " + directory.toString());

checkSize(directory);
checkCount(directory);
checkDates(directory);
Expand Down Expand Up @@ -425,14 +429,16 @@ public static int calculateBackupCount(File directory) {
}

private static void checkCount(File directory) {
if (ConfigManager.backupsToKeep.get() <= 0) return;
if (ConfigManager.backupsToKeep.get() <= 0) { System.out.println("Backup count check disabled"); return;}
long date = 0;
while (true) {
if (calculateBackupCount(directory) <= ConfigManager.backupsToKeep.get()) return;
if (calculateBackupCount(directory) <= ConfigManager.backupsToKeep.get()) { System.out.println("Backup count under configured size"); return;}
File file = getFirstBackupAfterDate(directory, date);
File dependent = getDependent(file);
if (dependent == null) {
//either a broken differential / incremental chain, a full backup with no dependencies or a zip backup
System.out.println("Deleting full / broken partial backup with name : " + file.toString());
if (dependent.isDirectory()) System.out.println("This is a directory!");
if (file.isDirectory()) deleteDirectoryContents(file);
file.delete();
return;
Expand All @@ -454,6 +460,8 @@ private static void checkCount(File directory) {
}
}
else {
System.out.println("Deleting differential backup with name " + file.toString());
if (dependent.isDirectory()) System.out.println("This is a directory!");
if (dependent.isDirectory()) deleteDirectoryContents(dependent);
dependent.delete();
}
Expand Down

0 comments on commit c3e247b

Please sign in to comment.