Backed out merge changeset: c3a217f258da

Backed out merge revision to its second parent (d44635d5d6c5)
This commit is contained in:
Virtuworks 2012-09-18 22:15:08 -04:00
parent ec856b89f2
commit d91b32e156
13 changed files with 350 additions and 658 deletions

View file

@ -912,113 +912,5 @@ namespace WebsitePanel.EnterpriseServer
return users.ToArray();
}
public static int SetFolderQuota(int packageId, string path)
{
// check account
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
if (accountCheck < 0) return accountCheck;
// check package
int packageCheck = SecurityContext.CheckPackage(packageId, DemandPackage.IsActive);
if (packageCheck < 0) return packageCheck;
// place log record
TaskManager.StartTask("FILES", "SET_QUOTA_ON_FOLDER", path);
TaskManager.ItemId = packageId;
try
{
// file server cluster name
string fileServerClusterName = String.Empty;
// Share Name where home folders are created
string shareName = String.Empty;
string[] splits = GetHomeFolder(packageId).Split('\\');
if (splits.Length > 4)
{
fileServerClusterName = splits[2];
shareName = splits[3];
}
// disk space quota
QuotaValueInfo diskSpaceQuota = PackageController.GetPackageQuota(packageId, Quotas.OS_DISKSPACE);
// bat file pat
string cmdFilePath = @"\\" + fileServerClusterName + @"\" + shareName + @"\" + "Process.bat";
#region figure Quota Unit
// Quota Unit
string unit = String.Empty;
if (diskSpaceQuota.QuotaDescription.ToLower().Contains("gb"))
unit = "GB";
else if (diskSpaceQuota.QuotaDescription.ToLower().Contains("mb"))
unit = "MB";
else
unit = "KB";
#endregion
OS.OperatingSystem os = GetOS(packageId);
os.SetQuotaLimitOnFolder(cmdFilePath, fileServerClusterName, path, diskSpaceQuota.QuotaAllocatedValue.ToString() + unit, 0, String.Empty, String.Empty);
return 0;
}
catch (Exception ex)
{
//Log and return a generic error rather than throwing an exception
TaskManager.WriteError(ex);
return BusinessErrorCodes.ERROR_FILE_GENERIC_LOGGED;
}
finally
{
TaskManager.CompleteTask();
}
}
public static int DeleteDirectoryRecursive(int packageId, string rootPath)
{
// check account
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
if (accountCheck < 0) return accountCheck;
// check package
int packageCheck = SecurityContext.CheckPackage(packageId, DemandPackage.IsActive);
if (packageCheck < 0) return packageCheck;
// place log record
TaskManager.StartTask("FILES", "DELETE_DIRECTORY_RECURSIVE", rootPath);
TaskManager.ItemId = packageId;
try
{
OS.OperatingSystem os = GetOS(packageId);
os.DeleteDirectoryRecursive(rootPath);
return 0;
}
catch (Exception ex)
{
//Log and return a generic error rather than throwing an exception
TaskManager.WriteError(ex);
return BusinessErrorCodes.ERROR_FILE_GENERIC_LOGGED;
}
finally
{
TaskManager.CompleteTask();
}
}
}
}