case 4460

This commit is contained in:
2023-03-07 00:20:48 +00:00
parent 9acda7f819
commit 4d3db625b5
2 changed files with 5 additions and 5 deletions

View File

@@ -56,7 +56,7 @@ namespace Sockeye.Biz
DateTime dtStartBackup = DateTime.Now; DateTime dtStartBackup = DateTime.Now;
log.LogDebug("Backup starting"); log.LogDebug("Backup starting");
var DemandFileNamePrepend = OnDemand ? "manual-" : string.Empty; //var DemandFileNamePrepend = OnDemand ? "manual-" : string.Empty;
//************* //*************
//DO DATA BACKUP //DO DATA BACKUP
//build command //build command
@@ -67,7 +67,7 @@ namespace Sockeye.Biz
Npgsql.NpgsqlConnectionStringBuilder PostgresConnectionString = new Npgsql.NpgsqlConnectionStringBuilder(ServerBootConfig.SOCKEYE_DB_CONNECTION); Npgsql.NpgsqlConnectionStringBuilder PostgresConnectionString = new Npgsql.NpgsqlConnectionStringBuilder(ServerBootConfig.SOCKEYE_DB_CONNECTION);
var DBNameParameter = $"--dbname=postgresql://{PostgresConnectionString.Username}:{PostgresConnectionString.Password}@{PostgresConnectionString.Host}:{PostgresConnectionString.Port}/{PostgresConnectionString.Database}"; var DBNameParameter = $"--dbname=postgresql://{PostgresConnectionString.Username}:{PostgresConnectionString.Password}@{PostgresConnectionString.Host}:{PostgresConnectionString.Port}/{PostgresConnectionString.Database}";
var DataBackupFile = $"{DemandFileNamePrepend}db-{FileUtil.GetSafeDateFileName()}.backup";//presentation issue so don't use UTC for this one var DataBackupFile = $"db-{FileUtil.GetSafeDateFileName()}.backup";//presentation issue so don't use UTC for this one
DataBackupFile = FileUtil.GetFullPathForBackupFile(DataBackupFile); DataBackupFile = FileUtil.GetFullPathForBackupFile(DataBackupFile);
var BackupUtilityCommand = "pg_dump"; var BackupUtilityCommand = "pg_dump";
@@ -108,7 +108,7 @@ namespace Sockeye.Biz
if (ServerGlobalOpsSettingsCache.Backup.BackupAttachments) if (ServerGlobalOpsSettingsCache.Backup.BackupAttachments)
{ {
await JobsBiz.LogJobAsync(Guid.Empty, $"LT:Backup LT:Attachments"); await JobsBiz.LogJobAsync(Guid.Empty, $"LT:Backup LT:Attachments");
FileUtil.BackupAttachments(DemandFileNamePrepend); FileUtil.BackupAttachments();
log.LogDebug("Backup of file attachments completed OK"); log.LogDebug("Backup of file attachments completed OK");
} }

View File

@@ -588,11 +588,11 @@ namespace Sockeye.Util
} }
internal static void BackupAttachments(string demandFileNamePrepend, ILogger log = null) internal static void BackupAttachments( ILogger log = null)
{ {
try try
{ {
var AttachmentsBackupFile = $"{demandFileNamePrepend}at-{FileUtil.GetSafeDateFileName()}.zip";//presentation issue so don't use UTC for this one var AttachmentsBackupFile = $"at-{FileUtil.GetSafeDateFileName()}.zip";//presentation issue so don't use UTC for this one
AttachmentsBackupFile = GetFullPathForBackupFile(AttachmentsBackupFile); AttachmentsBackupFile = GetFullPathForBackupFile(AttachmentsBackupFile);
System.IO.Compression.ZipFile.CreateFromDirectory(ServerBootConfig.SOCKEYE_ATTACHMENT_FILES_PATH, AttachmentsBackupFile); System.IO.Compression.ZipFile.CreateFromDirectory(ServerBootConfig.SOCKEYE_ATTACHMENT_FILES_PATH, AttachmentsBackupFile);