This commit is contained in:
@@ -146,6 +146,10 @@ namespace AyaNova.Biz
|
||||
//FILES ON DISK
|
||||
var UtilFilesInfo = FileUtil.GetUtilityFolderSizeInfo();
|
||||
var AttachmentFilesInfo = FileUtil.GetAttachmentFolderSizeInfo();
|
||||
|
||||
//Available space
|
||||
|
||||
|
||||
using (AyContext ct = ServiceProviderProvider.DBContext)
|
||||
{
|
||||
//write to db
|
||||
|
||||
@@ -180,7 +180,7 @@ namespace AyaNova.Util
|
||||
DateTime LastBackup = DateTime.MinValue;
|
||||
var BackupPath = UtilityFilesFolder;
|
||||
foreach (string file in Directory.EnumerateFiles(UtilityFilesFolder, "db-*.backup"))
|
||||
{
|
||||
{
|
||||
var ThisFileTime = File.GetCreationTimeUtc(file);
|
||||
if (ThisFileTime > LastBackup)
|
||||
{
|
||||
@@ -260,7 +260,20 @@ namespace AyaNova.Util
|
||||
|
||||
}
|
||||
|
||||
internal static long UtilityFilesDriveAvailableSpace()
|
||||
{
|
||||
try
|
||||
{
|
||||
return new System.IO.DriveInfo(Path.GetPathRoot(UtilityFilesFolder)).AvailableFreeSpace;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger("FileUtil::UtilityFilesDriveAvailableSpace");
|
||||
log.LogError(ex, "FileUtil::UtilityFilesDriveAvailableSpace error getting available space");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Utility file handling
|
||||
|
||||
@@ -505,7 +518,7 @@ namespace AyaNova.Util
|
||||
}
|
||||
|
||||
|
||||
internal static void BackupAttachments(string demandFileNamePrepend,ILogger log = null)
|
||||
internal static void BackupAttachments(string demandFileNamePrepend, ILogger log = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -524,7 +537,20 @@ namespace AyaNova.Util
|
||||
}
|
||||
}
|
||||
|
||||
internal static long AttachmentFilesDriveAvailableSpace()
|
||||
{
|
||||
try
|
||||
{
|
||||
return new System.IO.DriveInfo(Path.GetPathRoot(UserFilesFolder)).AvailableFreeSpace;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger("FileUtil::AttachmentFilesDriveAvailableSpace");
|
||||
log.LogError(ex, "FileUtil::AttachmentFilesDriveAvailableSpace error getting available space");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endregion attachment stuff
|
||||
|
||||
#region General utilities
|
||||
|
||||
Reference in New Issue
Block a user