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 @@ namespace NzbDrone.Api.Indexers
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.Disk;
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 @@ namespace NzbDrone.Core.Update
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 @@ namespace NzbDrone.Core.Update
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 @@ namespace NzbDrone.Core.Update
_updateVerifier = updateVerifier;
_configFileProvider = configFileProvider;
_runtimeInfo = runtimeInfo;
_backupService = backupService;
_logger = logger;
}
@ -90,6 +95,8 @@ namespace NzbDrone.Core.Update
_archiveService.Extract(packageDestination, updateSandboxFolder);
_logger.Info("Update package extracted successfully");
_backupService.Backup(BackupType.Update);
if (OsInfo.IsMono && _configFileProvider.UpdateMechanism == UpdateMechanism.Script)
{
InstallUpdateWithScript(updateSandboxFolder);