This commit is contained in:
@@ -81,7 +81,7 @@ namespace AyaNova.Biz
|
||||
log.LogInformation("BACKUP STUB: ATTACHMENTS BACKUP RUNNING NOW");
|
||||
|
||||
//PRUNE BACKUP SETS NOT KEPT
|
||||
FileUtil.BackupCleanUp(ServerGlobalOpsSettings.BackupSetsToKeep);
|
||||
FileUtil.DatabaseBackupCleanUp(ServerGlobalOpsSettings.BackupSetsToKeep);
|
||||
|
||||
|
||||
//v.next - COPY TO ONLINE STORAGE
|
||||
|
||||
@@ -159,10 +159,31 @@ namespace AyaNova.Util
|
||||
/// Cleanup excess backups (backup folder file)
|
||||
/// </summary>
|
||||
/// <param name="keepCount"></param>
|
||||
internal static void BackupCleanUp(int keepCount)
|
||||
internal static void DatabaseBackupCleanUp(int keepCount)
|
||||
{
|
||||
if (keepCount < 1) keepCount = 1;
|
||||
var BackupFileList = UtilityFileList("*.backup");
|
||||
var BackupFileList = UtilityFileList("db-*.backup");
|
||||
|
||||
if (BackupFileList.Count > keepCount)
|
||||
{
|
||||
//sort, skip newest x (keepcount) delete the rest
|
||||
var DeleteCount = BackupFileList.Count - keepCount;
|
||||
var DeleteFileList = BackupFileList.OrderByDescending(m => m).Skip(keepCount).ToList();
|
||||
foreach (string ExtraBackupFile in DeleteFileList)
|
||||
{
|
||||
DeleteUtilityFile(ExtraBackupFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cleanup excess backups (backup folder file)
|
||||
/// </summary>
|
||||
/// <param name="keepCount"></param>
|
||||
internal static void AttachmentBackupCleanUp(int keepCount)
|
||||
{
|
||||
if (keepCount < 1) keepCount = 1;
|
||||
var BackupFileList = UtilityFileList("at-*.zip");
|
||||
|
||||
if (BackupFileList.Count > keepCount)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user