Skip to content

Commit

Permalink
Fixing restoreAmount & changes to logic
Browse files Browse the repository at this point in the history
Co-Authored-By: AntsyLich <[email protected]>
  • Loading branch information
Animeboynz and AntsyLich committed Aug 7, 2024
1 parent b6f5c6c commit 1bfa581
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class BackupRestorer(
restoreAmount += 1
}
if (options.extensionRepoSettings) {
restoreAmount += 1
restoreAmount += backup.backupExtensionRepo.size
}
if (options.sourceSettings) {
restoreAmount += 1
Expand Down Expand Up @@ -192,7 +192,7 @@ class BackupRestorer(
private fun writeErrorLog(): File {
try {
if (errors.isNotEmpty()) {
val file = context.createFileInCacheDir("mihon_restore.txt")
val file = context.createFileInCacheDir("mihon_restore_error.txt")
val sdf = SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.getDefault())

file.bufferedWriter().use { out ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,11 @@ class ExtensionRepoRestorer(
val urlExists = existingReposByUrl[backupRepo.baseUrl]
val shaExists = existingReposBySHA[backupRepo.signingKeyFingerprint]

if (urlExists != null) {
// URL exists, check fingerprint
if (urlExists.signingKeyFingerprint != backupRepo.signingKeyFingerprint) {
error("Already Exists with different signing key fingerprint")
}
if (urlExists != null && urlExists.signingKeyFingerprint != backupRepo.signingKeyFingerprint) {
error("Already Exists with different signing key fingerprint")
} else if (shaExists != null) {
// URL does not exist, check if some other repo has the fingerprint
error("${shaExists.name} has the same signing key fingerprint")
} else {
// Restore backup
handler.await {
extension_reposQueries.insert(
backupRepo.baseUrl,
Expand Down

0 comments on commit 1bfa581

Please sign in to comment.