svoid restoreLatestBackupIfConceptsFileEmpty(S dbID, O... _) { bool doIt = boolPar doIt(_); File file = conceptsFile(dbID); if (fileExists(file) && fileSize(file) == 0) { print(file + " corrupted, trying to restore"); File backup = lastThat fileNotEmpty(sortByFileName(conceptBackupFiles(dbID))); if (backup == null) ret with print("No usable backup found :("); S msg = "RESTORING: " + backup; File log = javaxDataDir("db-restores.log"); if (doIt) logQuotedWithTime(log, msg); print(stringIf(!doIt, "[would be] ") + msg); if (doIt) { clearConceptsOf(dbID); copyFile(backup, file); print(msg = "DB RESTORED!"); if (doIt) logQuotedWithTime(log, msg); } } }