WebDav Performance issues fixed

This commit is contained in:
vfedosevich 2014-03-05 12:14:41 -08:00
parent 5cf9bfa4bb
commit 22745dde02
3 changed files with 69 additions and 14 deletions

View file

@ -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;