mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 05:53:33 -07:00
Cleaned up Backup.
This commit is contained in:
parent
928bc55839
commit
8ce6e8a08e
5 changed files with 69 additions and 41 deletions
|
@ -10,19 +10,7 @@ namespace NzbDrone.Core.Providers.Core
|
|||
{
|
||||
public class ArchiveProvider
|
||||
{
|
||||
private readonly EnviromentProvider _enviromentProvider;
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public ArchiveProvider(EnviromentProvider enviromentProvider)
|
||||
{
|
||||
_enviromentProvider = enviromentProvider;
|
||||
}
|
||||
|
||||
public ArchiveProvider()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ExtractArchive(string compressedFile, string destination)
|
||||
{
|
||||
|
@ -35,29 +23,5 @@ namespace NzbDrone.Core.Providers.Core
|
|||
|
||||
logger.Trace("Extraction complete.");
|
||||
}
|
||||
|
||||
public virtual FileInfo CreateBackupZip()
|
||||
{
|
||||
try
|
||||
{
|
||||
var dbFile = PathExtentions.GetNzbDronoeDbFile(_enviromentProvider);
|
||||
var configFile = PathExtentions.GetConfigPath(_enviromentProvider);
|
||||
var zipFile = Path.Combine(PathExtentions.GetAppDataPath(_enviromentProvider), "NzbDrone_Backup.zip");
|
||||
|
||||
using (var zip = new ZipFile())
|
||||
{
|
||||
zip.AddFile(dbFile, String.Empty);
|
||||
zip.AddFile(configFile, String.Empty);
|
||||
zip.Save(zipFile);
|
||||
}
|
||||
|
||||
return new FileInfo(zipFile);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
logger.WarnException("Failed to create backup zip", ex);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue