mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Backups
New: Backup drone's database and configuration from the UI New: Download Backup files from the UI Fixed: Run a database backup before upgrade
This commit is contained in:
32
src/NzbDrone.Api/System/Backup/BackupModule.cs
Normal file
32
src/NzbDrone.Api/System/Backup/BackupModule.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.Backup;
|
||||
|
||||
namespace NzbDrone.Api.System.Backup
|
||||
{
|
||||
public class BackupModule : NzbDroneRestModule<BackupResource>
|
||||
{
|
||||
private readonly IBackupService _backupService;
|
||||
|
||||
public BackupModule(IBackupService backupService) : base("system/backup")
|
||||
{
|
||||
_backupService = backupService;
|
||||
GetResourceAll = GetBackupFiles;
|
||||
}
|
||||
|
||||
public List<BackupResource> GetBackupFiles()
|
||||
{
|
||||
var backups = _backupService.GetBackups();
|
||||
|
||||
return backups.Select(b => new BackupResource
|
||||
{
|
||||
Id = b.Path.GetHashCode(),
|
||||
Name = Path.GetFileName(b.Path),
|
||||
Path = b.Path,
|
||||
Type = b.Type,
|
||||
Time = b.Time
|
||||
}).ToList();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user