This commit is contained in:
2020-05-19 23:28:31 +00:00
parent 2abb64de82
commit dea4369501
2 changed files with 41 additions and 17 deletions

View File

@@ -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