mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02:00
Fixed: If v0.2 DB Exists back it up during update
This commit is contained in:
parent
ede7d37cae
commit
2d9c77ec5e
@ -12,6 +12,7 @@ public static class PathExtensions
|
||||
{
|
||||
private const string APP_CONFIG_FILE = "config.xml";
|
||||
private const string DB = "radarr.db";
|
||||
private const string DB_OLD = "nzbdrone.db";
|
||||
private const string DB_RESTORE = "radarr.restore";
|
||||
private const string LOG_DB = "logs.db";
|
||||
private const string NLOG_CONFIG_FILE = "nlog.config";
|
||||
@ -303,6 +304,11 @@ public static string GetUpdateBackupDatabase(this IAppFolderInfo appFolderInfo)
|
||||
return Path.Combine(GetUpdateBackUpAppDataFolder(appFolderInfo), DB);
|
||||
}
|
||||
|
||||
public static string GetV0UpdateBackupDatabase(this IAppFolderInfo appFolderInfo)
|
||||
{
|
||||
return Path.Combine(GetUpdateBackUpAppDataFolder(appFolderInfo), DB_OLD);
|
||||
}
|
||||
|
||||
public static string GetUpdatePackageFolder(this IAppFolderInfo appFolderInfo)
|
||||
{
|
||||
return Path.Combine(GetUpdateSandboxFolder(appFolderInfo), UPDATE_PACKAGE_FOLDER_NAME);
|
||||
@ -323,6 +329,11 @@ public static string GetDatabase(this IAppFolderInfo appFolderInfo)
|
||||
return Path.Combine(GetAppDataPath(appFolderInfo), DB);
|
||||
}
|
||||
|
||||
public static string GetV0Database(this IAppFolderInfo appFolderInfo)
|
||||
{
|
||||
return Path.Combine(GetAppDataPath(appFolderInfo), DB_OLD);
|
||||
}
|
||||
|
||||
public static string GetDatabaseRestore(this IAppFolderInfo appFolderInfo)
|
||||
{
|
||||
return Path.Combine(GetAppDataPath(appFolderInfo), DB_RESTORE);
|
||||
|
@ -46,7 +46,16 @@ public void Backup()
|
||||
try
|
||||
{
|
||||
_diskTransferService.TransferFile(_appFolderInfo.GetConfigPath(), _appFolderInfo.GetUpdateBackupConfigFile(), TransferMode.Copy);
|
||||
_diskTransferService.TransferFile(_appFolderInfo.GetDatabase(), _appFolderInfo.GetUpdateBackupDatabase(), TransferMode.Copy);
|
||||
|
||||
//Backup new db if exists, else try old then fail
|
||||
if (_diskProvider.FileExists(_appFolderInfo.GetDatabase()))
|
||||
{
|
||||
_diskTransferService.TransferFile(_appFolderInfo.GetDatabase(), _appFolderInfo.GetUpdateBackupDatabase(), TransferMode.Copy);
|
||||
}
|
||||
else
|
||||
{
|
||||
_diskTransferService.TransferFile(_appFolderInfo.GetV0Database(), _appFolderInfo.GetV0UpdateBackupDatabase(), TransferMode.Copy);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user