mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 05:53:33 -07:00
moved data from Roaming to ProgramData.
Cleaned up DiskProvider
This commit is contained in:
parent
7ff1335a2e
commit
d60b863e14
33 changed files with 202 additions and 242 deletions
|
@ -13,27 +13,27 @@ namespace NzbDrone.Update.UpdateEngine
|
|||
public class BackupAndRestore : IBackupAndRestore
|
||||
{
|
||||
private readonly IDiskProvider _diskProvider;
|
||||
private readonly IAppDirectoryInfo _appDirectoryInfo;
|
||||
private readonly IAppFolderInfo _appFolderInfo;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public BackupAndRestore(IDiskProvider diskProvider, IAppDirectoryInfo appDirectoryInfo, Logger logger)
|
||||
public BackupAndRestore(IDiskProvider diskProvider, IAppFolderInfo appFolderInfo, Logger logger)
|
||||
{
|
||||
_diskProvider = diskProvider;
|
||||
_appDirectoryInfo = appDirectoryInfo;
|
||||
_appFolderInfo = appFolderInfo;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void BackUp(string source)
|
||||
{
|
||||
_logger.Info("Creating backup of existing installation");
|
||||
_diskProvider.CopyDirectory(source, _appDirectoryInfo.GetUpdateBackUpFolder());
|
||||
_diskProvider.CopyFolder(source, _appFolderInfo.GetUpdateBackUpFolder());
|
||||
}
|
||||
|
||||
public void Restore(string target)
|
||||
{
|
||||
//TODO:this should ignore single file failures.
|
||||
_logger.Info("Attempting to rollback upgrade");
|
||||
_diskProvider.CopyDirectory(_appDirectoryInfo.GetUpdateBackUpFolder(), target);
|
||||
_diskProvider.CopyFolder(_appFolderInfo.GetUpdateBackUpFolder(), target);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,18 +16,18 @@ namespace NzbDrone.Update.UpdateEngine
|
|||
private readonly IDiskProvider _diskProvider;
|
||||
private readonly IDetectApplicationType _detectApplicationType;
|
||||
private readonly ITerminateNzbDrone _terminateNzbDrone;
|
||||
private readonly IAppDirectoryInfo _appDirectoryInfo;
|
||||
private readonly IAppFolderInfo _appFolderInfo;
|
||||
private readonly IBackupAndRestore _backupAndRestore;
|
||||
private readonly IStartNzbDrone _startNzbDrone;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public InstallUpdateService(IDiskProvider diskProvider, IDetectApplicationType detectApplicationType, ITerminateNzbDrone terminateNzbDrone,
|
||||
IAppDirectoryInfo appDirectoryInfo, IBackupAndRestore backupAndRestore, IStartNzbDrone startNzbDrone, Logger logger)
|
||||
IAppFolderInfo appFolderInfo, IBackupAndRestore backupAndRestore, IStartNzbDrone startNzbDrone, Logger logger)
|
||||
{
|
||||
_diskProvider = diskProvider;
|
||||
_detectApplicationType = detectApplicationType;
|
||||
_terminateNzbDrone = terminateNzbDrone;
|
||||
_appDirectoryInfo = appDirectoryInfo;
|
||||
_appFolderInfo = appFolderInfo;
|
||||
_backupAndRestore = backupAndRestore;
|
||||
_startNzbDrone = startNzbDrone;
|
||||
_logger = logger;
|
||||
|
@ -44,8 +44,8 @@ namespace NzbDrone.Update.UpdateEngine
|
|||
throw new DirectoryNotFoundException("Target folder doesn't exist " + targetFolder);
|
||||
|
||||
_logger.Info("Verifying Update Folder");
|
||||
if (!_diskProvider.FolderExists(_appDirectoryInfo.GetUpdatePackageFolder()))
|
||||
throw new DirectoryNotFoundException("Update folder doesn't exist " + _appDirectoryInfo.GetUpdatePackageFolder());
|
||||
if (!_diskProvider.FolderExists(_appFolderInfo.GetUpdatePackageFolder()))
|
||||
throw new DirectoryNotFoundException("Update folder doesn't exist " + _appFolderInfo.GetUpdatePackageFolder());
|
||||
}
|
||||
|
||||
public void Start(string installationFolder)
|
||||
|
@ -64,7 +64,7 @@ namespace NzbDrone.Update.UpdateEngine
|
|||
|
||||
try
|
||||
{
|
||||
_diskProvider.CopyDirectory(_appDirectoryInfo.GetUpdatePackageFolder(), installationFolder);
|
||||
_diskProvider.CopyFolder(_appFolderInfo.GetUpdatePackageFolder(), installationFolder);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue