Feature/automatic backup flags (#1702)
* Add backup flags to auto backups * Mark ServerConfig properties as deprecated --------- Co-authored-by: Mitchell Syer <Syer10@users.noreply.github.com>
This commit is contained in:
@@ -1,54 +0,0 @@
|
||||
package suwayomi.tachidesk.manga.impl.backup
|
||||
|
||||
import suwayomi.tachidesk.manga.impl.backup.proto.models.Backup
|
||||
|
||||
/*
|
||||
* Copyright (C) Contributors to the Suwayomi project
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
interface IBackupFlags {
|
||||
val includeManga: Boolean?
|
||||
val includeCategories: Boolean?
|
||||
val includeChapters: Boolean?
|
||||
val includeTracking: Boolean?
|
||||
val includeHistory: Boolean?
|
||||
val includeClientData: Boolean?
|
||||
val includeServerSettings: Boolean?
|
||||
}
|
||||
|
||||
data class BackupFlags(
|
||||
override val includeManga: Boolean,
|
||||
override val includeCategories: Boolean,
|
||||
override val includeChapters: Boolean,
|
||||
override val includeTracking: Boolean,
|
||||
override val includeHistory: Boolean,
|
||||
override val includeClientData: Boolean,
|
||||
override val includeServerSettings: Boolean,
|
||||
) : IBackupFlags {
|
||||
companion object {
|
||||
val DEFAULT =
|
||||
BackupFlags(
|
||||
includeManga = true,
|
||||
includeCategories = true,
|
||||
includeChapters = true,
|
||||
includeTracking = true,
|
||||
includeHistory = true,
|
||||
includeClientData = true,
|
||||
includeServerSettings = true,
|
||||
)
|
||||
|
||||
fun fromPartial(partialFlags: IBackupFlags?): BackupFlags =
|
||||
BackupFlags(
|
||||
includeManga = partialFlags?.includeManga ?: DEFAULT.includeManga,
|
||||
includeCategories = partialFlags?.includeCategories ?: DEFAULT.includeCategories,
|
||||
includeChapters = partialFlags?.includeChapters ?: DEFAULT.includeChapters,
|
||||
includeTracking = partialFlags?.includeTracking ?: DEFAULT.includeTracking,
|
||||
includeHistory = partialFlags?.includeHistory ?: DEFAULT.includeHistory,
|
||||
includeClientData = partialFlags?.includeClientData ?: DEFAULT.includeClientData,
|
||||
includeServerSettings = partialFlags?.includeServerSettings ?: DEFAULT.includeServerSettings,
|
||||
)
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -98,7 +98,7 @@ object ProtoBackupExport : ProtoBackupBase() {
|
||||
private fun createAutomatedBackup() {
|
||||
logger.info { "Creating automated backup..." }
|
||||
|
||||
createBackup(BackupFlags.DEFAULT).use { input ->
|
||||
createBackup(BackupFlags.fromServerConfig()).use { input ->
|
||||
val automatedBackupDir = File(applicationDirs.automatedBackupRoot)
|
||||
automatedBackupDir.mkdirs()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user