Backup before update

pull/4/head
Mark McDowall 11 years ago
parent 65e4de7441
commit 140427c76e

@ -39,5 +39,6 @@ namespace NzbDrone.Api.Indexers
public Boolean IsDaily { get; set; } public Boolean IsDaily { get; set; }
public Boolean IsAbsoluteNumbering { get; set; } public Boolean IsAbsoluteNumbering { get; set; }
public Boolean IsPossibleSpecialEpisode { get; set; } public Boolean IsPossibleSpecialEpisode { get; set; }
public Boolean Special { get; set; }
} }
} }

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

Loading…
Cancel
Save