WebDav Performance issues fixed
This commit is contained in:
parent
5cf9bfa4bb
commit
22745dde02
3 changed files with 69 additions and 14 deletions
|
@ -81,6 +81,8 @@ namespace WebsitePanel.Providers.EnterpriseStorage
|
|||
|
||||
// get directories
|
||||
DirectoryInfo[] dirs = root.GetDirectories();
|
||||
var quotas = windows.GetQuotasForOrganization(rootPath, string.Empty, string.Empty);
|
||||
|
||||
foreach (DirectoryInfo dir in dirs)
|
||||
{
|
||||
string fullName = System.IO.Path.Combine(rootPath, dir.Name);
|
||||
|
@ -91,9 +93,9 @@ namespace WebsitePanel.Providers.EnterpriseStorage
|
|||
folder.FullName = dir.FullName;
|
||||
folder.IsDirectory = true;
|
||||
|
||||
Quota quota = windows.GetQuotaOnFolder(fullName, string.Empty, string.Empty);
|
||||
|
||||
folder.Size = quota.Usage;
|
||||
if (quotas.ContainsKey(fullName))
|
||||
{
|
||||
folder.Size = quotas[fullName].Usage;
|
||||
|
||||
if (folder.Size == -1)
|
||||
{
|
||||
|
@ -102,14 +104,15 @@ namespace WebsitePanel.Providers.EnterpriseStorage
|
|||
|
||||
folder.Url = string.Format("https://{0}/{1}/{2}", setting.Domain, organizationId, dir.Name);
|
||||
folder.Rules = webdav.GetFolderWebDavRules(organizationId, dir.Name);
|
||||
folder.FRSMQuotaMB = quota.Size;
|
||||
folder.FRSMQuotaMB = quotas[fullName].Size;
|
||||
folder.FRSMQuotaGB = windows.ConvertMegaBytesToGB(folder.FRSMQuotaMB);
|
||||
folder.FsrmQuotaType = quota.QuotaType;
|
||||
folder.FsrmQuotaType = quotas[fullName].QuotaType;
|
||||
|
||||
items.Add(folder);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (SystemFile[])items.ToArray(typeof(SystemFile));
|
||||
}
|
||||
|
|
|
@ -220,6 +220,11 @@ namespace WebsitePanel.Providers.OS
|
|||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual Dictionary<string, Quota> GetQuotasForOrganization(string folderPath, string wmiUserName, string wmiPassword)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual void DeleteDirectoryRecursive(string rootPath)
|
||||
{
|
||||
FileUtils.DeleteDirectoryRecursive(rootPath);
|
||||
|
|
|
@ -175,6 +175,53 @@ namespace WebsitePanel.Providers.OS
|
|||
return quota;
|
||||
}
|
||||
|
||||
public override Dictionary<string, Quota> GetQuotasForOrganization(string folderPath, string wmiUserName, string wmiPassword)
|
||||
{
|
||||
Log.WriteStart("GetQuotasLimitsForOrganization");
|
||||
|
||||
|
||||
Runspace runSpace = null;
|
||||
Quota quota = null;
|
||||
var quotas = new Dictionary<string, Quota>();
|
||||
|
||||
try
|
||||
{
|
||||
runSpace = OpenRunspace();
|
||||
|
||||
Command cmd = new Command("Get-FsrmQuota");
|
||||
cmd.Parameters.Add("Path", folderPath + "\\*");
|
||||
var result = ExecuteShellCommand(runSpace, cmd, false);
|
||||
|
||||
if (result.Count > 0)
|
||||
{
|
||||
foreach (var element in result)
|
||||
{
|
||||
quota = new Quota();
|
||||
|
||||
quota.Size = ConvertBytesToMB(Convert.ToInt64(GetPSObjectProperty(element, "Size")));
|
||||
quota.QuotaType = Convert.ToBoolean(GetPSObjectProperty(element, "SoftLimit")) ? QuotaType.Soft : QuotaType.Hard;
|
||||
quota.Usage = ConvertBytesToMB(Convert.ToInt64(GetPSObjectProperty(element, "usage")));
|
||||
|
||||
quotas.Add(Convert.ToString(GetPSObjectProperty(element, "Path")), quota);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteError("GetQuotasLimitsForOrganization", ex);
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
CloseRunspace(runSpace);
|
||||
}
|
||||
|
||||
Log.WriteEnd("GetQuotasLimitsForOrganization");
|
||||
|
||||
return quotas;
|
||||
}
|
||||
|
||||
public UInt64 CalculateQuota(string quota)
|
||||
{
|
||||
UInt64 OneKb = 1024;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue