Backup
This commit is contained in:
@@ -4,6 +4,7 @@ using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using AyaNova.Models;
|
||||
@@ -440,6 +441,26 @@ namespace AyaNova.Util
|
||||
}
|
||||
|
||||
|
||||
internal static void BackupAttachments(ILogger log = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var AttachmentsBackupFile = $"at-{FileUtil.GetSafeDateFileName()}.zip";//presentation issue so don't use UTC for this one
|
||||
AttachmentsBackupFile = GetFullPathForUtilityFile(AttachmentsBackupFile);
|
||||
|
||||
System.IO.Compression.ZipFile.CreateFromDirectory(UserFilesFolder, AttachmentsBackupFile);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (log != null)
|
||||
{
|
||||
log.LogError(ex, $"FileUtil::BackupAttachments");
|
||||
}
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion attachment stuff
|
||||
|
||||
#region General utilities
|
||||
|
||||
Reference in New Issue
Block a user