From c3e247b64780658c1375802b22a5f717b95414f1 Mon Sep 17 00:00:00 2001 From: Heather White <66441550+MommyHeather@users.noreply.github.com> Date: Thu, 18 Jul 2024 04:24:35 +0100 Subject: [PATCH] Add some temporary debug logging --- .../advancedbackups/core/backups/BackupWrapper.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/co/uk/mommyheather/advancedbackups/core/backups/BackupWrapper.java b/src/main/java/co/uk/mommyheather/advancedbackups/core/backups/BackupWrapper.java index 1698aa9..ef5998e 100644 --- a/src/main/java/co/uk/mommyheather/advancedbackups/core/backups/BackupWrapper.java +++ b/src/main/java/co/uk/mommyheather/advancedbackups/core/backups/BackupWrapper.java @@ -340,6 +340,8 @@ public static void makeSnapshot(Consumer output) { public static void finishBackup(boolean snapshot) { ABCore.resetActivity(); + + System.out.println("Snapshot : " + snapshot); if (snapshot) return; @@ -360,6 +362,8 @@ public static void finishBackup(boolean snapshot) { } + System.out.println("Beginning purge checks : " + directory.toString()); + checkSize(directory); checkCount(directory); checkDates(directory); @@ -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; @@ -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(); }