1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00

Backup before update

This commit is contained in:
Mark McDowall 2014-07-09 18:51:01 -07:00
parent 65e4de7441
commit 140427c76e
2 changed files with 9 additions and 1 deletions

View File

@ -39,5 +39,6 @@ public class ReleaseResource : RestResource
public Boolean IsDaily { get; set; }
public Boolean IsAbsoluteNumbering { get; set; }
public Boolean IsPossibleSpecialEpisode { get; set; }
public Boolean Special { get; set; }
}
}

View File

@ -6,6 +6,7 @@
using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Common.Http;
using NzbDrone.Common.Processes;
using NzbDrone.Core.Backup;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Instrumentation.Extensions;
using NzbDrone.Core.Messaging.Commands;
@ -31,6 +32,7 @@ public class InstallUpdateService : IInstallUpdates, IExecute<ApplicationUpdateC
private readonly IVerifyUpdates _updateVerifier;
private readonly IConfigFileProvider _configFileProvider;
private readonly IRuntimeInfo _runtimeInfo;
private readonly IBackupService _backupService;
public InstallUpdateService(ICheckUpdateService checkUpdateService, IAppFolderInfo appFolderInfo,
@ -38,7 +40,9 @@ public InstallUpdateService(ICheckUpdateService checkUpdateService, IAppFolderIn
IArchiveService archiveService, IProcessProvider processProvider,
IVerifyUpdates updateVerifier,
IConfigFileProvider configFileProvider,
IRuntimeInfo runtimeInfo, Logger logger)
IRuntimeInfo runtimeInfo,
IBackupService backupService,
Logger logger)
{
if (configFileProvider == null)
{
@ -53,6 +57,7 @@ public InstallUpdateService(ICheckUpdateService checkUpdateService, IAppFolderIn
_updateVerifier = updateVerifier;
_configFileProvider = configFileProvider;
_runtimeInfo = runtimeInfo;
_backupService = backupService;
_logger = logger;
}
@ -90,6 +95,8 @@ public void InstallUpdate(UpdatePackage updatePackage)
_archiveService.Extract(packageDestination, updateSandboxFolder);
_logger.Info("Update package extracted successfully");
_backupService.Backup(BackupType.Update);
if (OsInfo.IsMono && _configFileProvider.UpdateMechanism == UpdateMechanism.Script)
{
InstallUpdateWithScript(updateSandboxFolder);