Dropped the initial commit for this work due to a large file. Had to do some cleanup from a bad merge.

This commit is contained in:
Joseph Milazzo 2021-03-23 12:27:04 -05:00
parent 931ecb1437
commit f63c38ac23
6 changed files with 9 additions and 7 deletions

View file

@ -95,7 +95,7 @@ namespace API.Services
/// Deletes all files within the directory, then the directory itself.
/// </summary>
/// <param name="directoryPath"></param>
public void ClearAndDeleteDirectory(string directoryPath)
public static void ClearAndDeleteDirectory(string directoryPath)
{
DirectoryInfo di = new DirectoryInfo(directoryPath);
@ -109,7 +109,7 @@ namespace API.Services
/// </summary>
/// <param name="directoryPath"></param>
/// <returns></returns>
public void ClearDirectory(string directoryPath)
public static void ClearDirectory(string directoryPath)
{
var di = new DirectoryInfo(directoryPath);
if (!di.Exists) return;

View file

@ -100,7 +100,7 @@ namespace API.Services
public void CleanupTemp()
{
var tempDirectory = Path.Join(Directory.GetCurrentDirectory(), "temp");
BackgroundJob.Enqueue((() => _directoryService.ClearDirectory(tempDirectory)));
BackgroundJob.Enqueue((() => DirectoryService.ClearDirectory(tempDirectory)));
}
public void BackupDatabase()

View file

@ -82,7 +82,7 @@ namespace API.Services.Tasks
var tempDirectory = Path.Join(_tempDirectory, dateString);
DirectoryService.ExistOrCreate(tempDirectory);
_directoryService.ClearDirectory(tempDirectory);
DirectoryService.ClearDirectory(tempDirectory);
_directoryService.CopyFilesToDirectory(
_backupFiles.Select(file => Path.Join(Directory.GetCurrentDirectory(), file)).ToList(), tempDirectory);
@ -95,7 +95,7 @@ namespace API.Services.Tasks
_logger.LogError(ex, "There was an issue when archiving library backup");
}
_directoryService.ClearAndDeleteDirectory(tempDirectory);
DirectoryService.ClearAndDeleteDirectory(tempDirectory);
_logger.LogInformation("Database backup completed");
}

View file

@ -26,7 +26,7 @@ namespace API.Services.Tasks
{
_logger.LogInformation("Cleaning temp directory");
var tempDirectory = Path.Join(Directory.GetCurrentDirectory(), "temp");
_directoryService.ClearDirectory(tempDirectory);
DirectoryService.ClearDirectory(tempDirectory);
_logger.LogInformation("Cleaning cache directory");
_cacheService.Cleanup();
_logger.LogInformation("Cleaning old database backups");