Backed out merge changeset: c3a217f258da
Backed out merge revision to its second parent (d44635d5d6c5)
This commit is contained in:
parent
ec856b89f2
commit
d91b32e156
13 changed files with 350 additions and 658 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -157,11 +157,11 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
public static int AddWebSite(int packageId, string hostName, int domainId, int ipAddressId)
|
||||
{
|
||||
return AddWebSite(packageId, hostName, domainId, ipAddressId, false);
|
||||
return AddWebSite(packageId, hostName, domainId, ipAddressId, false, true);
|
||||
}
|
||||
|
||||
public static int AddWebSite(int packageId, string hostName, int domainId, int packageAddressId,
|
||||
bool addInstantAlias)
|
||||
bool addInstantAlias, bool ignoreGlobalDNSRecords)
|
||||
{
|
||||
// check account
|
||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||
|
@ -180,12 +180,15 @@ namespace WebsitePanel.EnterpriseServer
|
|||
DomainInfo domain = ServerController.GetDomain(domainId);
|
||||
string domainName = domain.DomainName;
|
||||
|
||||
// check if the web site already exists
|
||||
if (PackageController.GetPackageItemByName(packageId, domainName, typeof(WebSite)) != null)
|
||||
string siteName = string.IsNullOrEmpty(hostName) ? domainName : hostName + "." + domainName;
|
||||
|
||||
// check if the web site already exists (legacy)
|
||||
if (PackageController.GetPackageItemByName(packageId, siteName, typeof(WebSite)) != null)
|
||||
return BusinessErrorCodes.ERROR_WEB_SITE_ALREADY_EXISTS;
|
||||
|
||||
if (DataProvider.CheckDomain(domain.PackageId, siteName, true) != 0)
|
||||
return BusinessErrorCodes.ERROR_WEB_SITE_ALREADY_EXISTS;
|
||||
|
||||
string siteName = string.IsNullOrEmpty(hostName) ? domainName : hostName + "." + domainName; ;
|
||||
|
||||
// place log record
|
||||
TaskManager.StartTask("WEB_SITE", "ADD", siteName);
|
||||
|
@ -198,7 +201,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
if (serviceId == 0)
|
||||
return BusinessErrorCodes.ERROR_WEB_SITE_SERVICE_UNAVAILABLE;
|
||||
|
||||
#region Fix for bug #587
|
||||
|
||||
// Initialize IIS provider webservice proxy
|
||||
WebServer web = new WebServer();
|
||||
ServiceProviderProxy.Init(web, serviceId);
|
||||
|
@ -216,7 +219,6 @@ namespace WebsitePanel.EnterpriseServer
|
|||
// Return generic operation failed error
|
||||
return BusinessErrorCodes.FAILED_EXECUTE_SERVICE_OPERATION;
|
||||
}
|
||||
#endregion
|
||||
|
||||
// load web settings
|
||||
StringDictionary webSettings = ServerController.GetServiceSettings(serviceId);
|
||||
|
@ -240,13 +242,6 @@ namespace WebsitePanel.EnterpriseServer
|
|||
if (ip != null)
|
||||
ipAddr = !String.IsNullOrEmpty(ip.InternalIP) ? ip.InternalIP : ip.ExternalIP;
|
||||
|
||||
// load domain instant alias
|
||||
/*
|
||||
string instantAlias = ServerController.GetDomainAlias(packageId, domainName);
|
||||
DomainInfo instantDomain = ServerController.GetDomain(instantAlias);
|
||||
if (instantDomain == null || instantDomain.WebSiteId > 0)
|
||||
instantAlias = "";
|
||||
*/
|
||||
|
||||
// load web DNS records
|
||||
List<GlobalDnsRecord> dnsRecords = ServerController.GetDnsRecordsByService(serviceId);
|
||||
|
@ -254,26 +249,15 @@ namespace WebsitePanel.EnterpriseServer
|
|||
// prepare site bindings
|
||||
List<ServerBinding> bindings = new List<ServerBinding>();
|
||||
|
||||
if (!dedicatedIp)
|
||||
{
|
||||
// SHARED IP
|
||||
// fill main domain bindings
|
||||
/*
|
||||
FillWebServerBindings(bindings, dnsRecords, ipAddr, domain.DomainName);
|
||||
FillWebServerBindings(bindings, dnsRecords, ipAddr, hostName, domain.DomainName, ignoreGlobalDNSRecords);
|
||||
|
||||
// fill alias bindings if required
|
||||
if (addInstantAlias && !String.IsNullOrEmpty(instantAlias))
|
||||
//double check all bindings
|
||||
foreach (ServerBinding b in bindings)
|
||||
{
|
||||
// fill bindings from DNS "A" records
|
||||
FillWebServerBindings(bindings, dnsRecords, ipAddr, instantAlias);
|
||||
}
|
||||
*/
|
||||
bindings.Add(new ServerBinding(ipAddr, "80", siteName));
|
||||
}
|
||||
else
|
||||
{
|
||||
// DEDICATED IP
|
||||
bindings.Add(new ServerBinding(ipAddr, "80", ""));
|
||||
if (DataProvider.CheckDomain(domain.PackageId, b.Host, true) != 0)
|
||||
return BusinessErrorCodes.ERROR_WEB_SITE_ALREADY_EXISTS;
|
||||
}
|
||||
|
||||
UserInfo user = PackageController.GetPackageOwner(packageId);
|
||||
|
@ -327,13 +311,11 @@ namespace WebsitePanel.EnterpriseServer
|
|||
site.EnableParentPaths = Utils.ParseBool(webPolicy["EnableParentPaths"], false);
|
||||
site.DedicatedApplicationPool = Utils.ParseBool(webPolicy["EnableDedicatedPool"], false);
|
||||
|
||||
#region Fix for bug: #1556
|
||||
|
||||
// Ensure the website meets hosting plan quotas
|
||||
QuotaValueInfo quotaInfo = PackageController.GetPackageQuota(packageId, Quotas.WEB_APPPOOLS);
|
||||
site.DedicatedApplicationPool = site.DedicatedApplicationPool && (quotaInfo.QuotaAllocatedValue > 0);
|
||||
|
||||
#endregion
|
||||
|
||||
site.EnableAnonymousAccess = Utils.ParseBool(webPolicy["EnableAnonymousAccess"], false);
|
||||
site.EnableWindowsAuthentication = Utils.ParseBool(webPolicy["EnableWindowsAuthentication"], false);
|
||||
site.EnableBasicAuthentication = Utils.ParseBool(webPolicy["EnableBasicAuthentication"], false);
|
||||
|
@ -377,9 +359,6 @@ namespace WebsitePanel.EnterpriseServer
|
|||
// CREATE WEB SITE
|
||||
siteId = web.CreateSite(site);
|
||||
|
||||
// Set hard quota on the website content folder
|
||||
FilesController.SetFolderQuota(packageId, site.DataPath);
|
||||
|
||||
// register item
|
||||
site.ServiceId = serviceId;
|
||||
site.PackageId = packageId;
|
||||
|
@ -395,13 +374,8 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
// update domain
|
||||
// add main pointer
|
||||
AddWebSitePointer(siteItemId, hostName, domain.DomainId, false);
|
||||
AddWebSitePointer(siteItemId, hostName, domain.DomainId, false, ignoreGlobalDNSRecords, false);
|
||||
|
||||
// add instant pointer
|
||||
/*
|
||||
if (addInstantAlias && !String.IsNullOrEmpty(instantAlias))
|
||||
AddWebSitePointer(siteItemId, instantDomain.DomainId, false);
|
||||
*/
|
||||
|
||||
// add parking page
|
||||
// load package
|
||||
|
@ -577,36 +551,26 @@ namespace WebsitePanel.EnterpriseServer
|
|||
// remove all web site pointers
|
||||
List<DomainInfo> pointers = GetWebSitePointers(siteItemId);
|
||||
foreach (DomainInfo pointer in pointers)
|
||||
DeleteWebSitePointer(siteItemId, pointer.DomainId, false);
|
||||
DeleteWebSitePointer(siteItemId, pointer.DomainId, false, true, true);
|
||||
|
||||
// remove web site main pointer
|
||||
DomainInfo domain = ServerController.GetDomain(siteItem.Name);
|
||||
if(domain != null)
|
||||
DeleteWebSitePointer(siteItemId, domain.DomainId, false);
|
||||
DeleteWebSitePointer(siteItemId, domain.DomainId, false, true, true);
|
||||
|
||||
// delete web site
|
||||
WebServer web = new WebServer();
|
||||
ServiceProviderProxy.Init(web, siteItem.ServiceId);
|
||||
|
||||
#region Fix for bug #710
|
||||
//
|
||||
if (web.IsFrontPageSystemInstalled() && web.IsFrontPageInstalled(siteItem.SiteId))
|
||||
{
|
||||
web.UninstallFrontPage(siteItem.SiteId, siteItem.FrontPageAccount);
|
||||
}
|
||||
#endregion
|
||||
|
||||
//
|
||||
web.DeleteSite(siteItem.SiteId);
|
||||
|
||||
// Delete WebManagementAccess Account
|
||||
WebServerController.RevokeWebManagementAccess(siteItemId);
|
||||
|
||||
// Delete website directory from file server
|
||||
// This will remove the hard quota as well
|
||||
FilesController.DeleteDirectoryRecursive(siteItem.PackageId, new DirectoryInfo(siteItem.DataPath).Parent.FullName);
|
||||
|
||||
|
||||
// delete service item
|
||||
PackageController.DeletePackageItem(siteItemId);
|
||||
|
||||
|
@ -622,8 +586,119 @@ namespace WebsitePanel.EnterpriseServer
|
|||
}
|
||||
}
|
||||
|
||||
public static int SwitchWebSiteToDedicatedIP(int siteItemId, int ipAddressId)
|
||||
{
|
||||
// check account
|
||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||
if (accountCheck < 0) return accountCheck;
|
||||
|
||||
// load web site item
|
||||
WebSite siteItem = (WebSite)PackageController.GetPackageItem(siteItemId);
|
||||
if (siteItem == null)
|
||||
return BusinessErrorCodes.ERROR_WEB_SITE_PACKAGE_ITEM_NOT_FOUND;
|
||||
|
||||
// load assigned IP address
|
||||
//IPAddressInfo ip = ServerController.GetIPAddress(ipAddressId);
|
||||
//if (ip == null)
|
||||
//return BusinessErrorCodes.ERROR_WEB_SITE_IP_ADDRESS_NOT_SPECIFIED;
|
||||
|
||||
//string ipAddr = !String.IsNullOrEmpty(ip.InternalIP) ? ip.InternalIP : ip.ExternalIP;
|
||||
int addressId = 0;
|
||||
PackageIPAddress packageIp = ServerController.GetPackageIPAddress(ipAddressId);
|
||||
if (packageIp != null)
|
||||
{
|
||||
addressId = packageIp.AddressID;
|
||||
}
|
||||
|
||||
|
||||
// place log record
|
||||
TaskManager.StartTask("WEB_SITE", "SWITCH_TO_DEDICATED_IP", siteItem.Name);
|
||||
TaskManager.ItemId = siteItemId;
|
||||
/*
|
||||
try
|
||||
{
|
||||
// remove all web site pointers
|
||||
List<DomainInfo> pointers = GetWebSitePointers(siteItemId);
|
||||
foreach (DomainInfo pointer in pointers)
|
||||
DeleteWebSitePointer(siteItemId, pointer.DomainId, true, true, false);
|
||||
|
||||
// remove web site main pointer
|
||||
DomainInfo domain = ServerController.GetDomain(siteItem.Name);
|
||||
if (domain != null)
|
||||
DeleteWebSitePointer(siteItemId, domain.DomainId, true, true, false);
|
||||
|
||||
// update site item
|
||||
siteItem.SiteIPAddressId = addressId;
|
||||
PackageController.UpdatePackageItem(siteItem);
|
||||
|
||||
// associate IP with web site
|
||||
if (addressId != 0)
|
||||
ServerController.AddItemIPAddress(siteItemId, addressId);
|
||||
|
||||
AddWebSitePointer(siteItemId, "", domain.DomainId, true, true, true);
|
||||
|
||||
foreach (DomainInfo pointer in pointers)
|
||||
AddWebSitePointer(siteItemId, "", pointer.DomainId, true, true, true);
|
||||
|
||||
return 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int SwitchWebSiteToSharedIP(int siteItemId)
|
||||
{
|
||||
// check account
|
||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||
if (accountCheck < 0) return accountCheck;
|
||||
|
||||
// load web site item
|
||||
WebSite siteItem = (WebSite)PackageController.GetPackageItem(siteItemId);
|
||||
if (siteItem == null)
|
||||
return BusinessErrorCodes.ERROR_WEB_SITE_PACKAGE_ITEM_NOT_FOUND;
|
||||
|
||||
// place log record
|
||||
TaskManager.StartTask("WEB_SITE", "SWITCH_TO_SHARED_IP", siteItem.Name);
|
||||
TaskManager.ItemId = siteItemId;
|
||||
/*
|
||||
try
|
||||
{
|
||||
// get web site pointers
|
||||
var sitePointers = GetWebSitePointers(siteItemId);
|
||||
|
||||
// get existing web site bindings
|
||||
WebServer web = new WebServer();
|
||||
ServiceProviderProxy.Init(web, siteItem.ServiceId);
|
||||
var bindings = web.GetSiteBindings(siteItem.SiteId);
|
||||
|
||||
// TODO - what would be correct logic here?
|
||||
|
||||
return 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
*/
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
private static void FillWebServerBindings(List<ServerBinding> bindings, List<GlobalDnsRecord> dnsRecords,
|
||||
string ipAddr, string hostName, string domainName)
|
||||
string ipAddr, string hostName, string domainName, bool ignoreGlobalDNSRecords)
|
||||
// TODO test if IPv6 works
|
||||
{
|
||||
int bindingsCount = bindings.Count;
|
||||
|
@ -632,35 +707,45 @@ namespace WebsitePanel.EnterpriseServer
|
|||
if ((dnsRecord.RecordType == "A" || dnsRecord.RecordType == "AAAA" || dnsRecord.RecordType == "CNAME") &&
|
||||
dnsRecord.RecordName != "*")
|
||||
{
|
||||
/*
|
||||
string recordData = dnsRecord.RecordName +
|
||||
((dnsRecord.RecordName != "") ? "." : "") + domainName;
|
||||
string recordData = Utils.ReplaceStringVariable(dnsRecord.RecordName, "host_name", hostName, true);
|
||||
|
||||
bindings.Add(new ServerBinding(ipAddr, "80", recordData));
|
||||
*/
|
||||
if (!string.IsNullOrEmpty(domainName))
|
||||
recordData = recordData + ((string.IsNullOrEmpty(recordData)) ? "" : ".") + domainName;
|
||||
//otherwise full recordData is supplied by hostName
|
||||
|
||||
string tmpName = string.Empty;
|
||||
if (!String.IsNullOrEmpty(hostName))
|
||||
tmpName = Utils.ReplaceStringVariable(dnsRecord.RecordName, "host_name", hostName);
|
||||
|
||||
string recordData = string.Empty;
|
||||
if (tmpName.Contains("."))
|
||||
recordData = hostName;
|
||||
else
|
||||
recordData = tmpName + ((tmpName != "") ? "." : "") + domainName;
|
||||
|
||||
bindings.Add(new ServerBinding(ipAddr, "80", recordData));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if(bindings.Count == bindingsCount)
|
||||
if (ignoreGlobalDNSRecords)
|
||||
{
|
||||
bindings.Add(new ServerBinding(ipAddr, "80", domainName));
|
||||
bindings.Add(new ServerBinding(ipAddr, "80", "www." + domainName));
|
||||
//only look for the host_nanme record, ignore all others
|
||||
if (dnsRecord.RecordName == "[host_name]")
|
||||
{
|
||||
AddBinding(bindings, new ServerBinding(ipAddr, "80", recordData));
|
||||
break;
|
||||
}
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
AddBinding(bindings, new ServerBinding(ipAddr, "80", recordData));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((bindings.Count == bindingsCount) | (bindings.Count == 0))
|
||||
{
|
||||
AddBinding(bindings, new ServerBinding(ipAddr, "80", string.IsNullOrEmpty(hostName) ? domainName : hostName + "." + domainName));
|
||||
}
|
||||
}
|
||||
|
||||
private static void AddBinding(List<ServerBinding> bindings, ServerBinding binding)
|
||||
{
|
||||
foreach (ServerBinding b in bindings)
|
||||
{
|
||||
if (string.Compare(b.Host, binding.Host, true) == 0)
|
||||
return;
|
||||
}
|
||||
|
||||
bindings.Add(binding);
|
||||
}
|
||||
|
||||
|
||||
private static string GetWebSiteUsername(UserSettings webPolicy, string domainName)
|
||||
{
|
||||
|
@ -747,10 +832,15 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
public static int AddWebSitePointer(int siteItemId, string hostName, int domainId)
|
||||
{
|
||||
return AddWebSitePointer(siteItemId, hostName, domainId, true);
|
||||
return AddWebSitePointer(siteItemId, hostName, domainId, true, true, false);
|
||||
}
|
||||
|
||||
internal static int AddWebSitePointer(int siteItemId, string hostName, int domainId, bool updateWebSite)
|
||||
{
|
||||
return AddWebSitePointer(siteItemId, hostName, domainId, updateWebSite, false, false);
|
||||
}
|
||||
|
||||
internal static int AddWebSitePointer(int siteItemId, string hostName, int domainId, bool updateWebSite, bool ignoreGlobalDNSRecords, bool rebuild)
|
||||
{
|
||||
// check account
|
||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||
|
@ -766,6 +856,13 @@ namespace WebsitePanel.EnterpriseServer
|
|||
if (domain == null)
|
||||
return BusinessErrorCodes.ERROR_DOMAIN_PACKAGE_ITEM_NOT_FOUND;
|
||||
|
||||
// check if the web site already exists
|
||||
if (!rebuild)
|
||||
{
|
||||
if (DataProvider.CheckDomain(domain.PackageId, string.IsNullOrEmpty(hostName) ? domain.DomainName : hostName + "." + domain.DomainName, true) != 0)
|
||||
return BusinessErrorCodes.ERROR_WEB_SITE_ALREADY_EXISTS;
|
||||
}
|
||||
|
||||
// get zone records for the service
|
||||
List<GlobalDnsRecord> dnsRecords = ServerController.GetDnsRecordsByService(siteItem.ServiceId);
|
||||
|
||||
|
@ -781,16 +878,62 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
// load appropriate zone
|
||||
DnsZone zone = (DnsZone)PackageController.GetPackageItem(domain.ZoneItemId);
|
||||
|
||||
|
||||
if (zone != null)
|
||||
{
|
||||
// change DNS zone
|
||||
List<GlobalDnsRecord> tmpDnsRecords = new List<GlobalDnsRecord>();
|
||||
|
||||
string serviceIp = (ip != null) ? ip.ExternalIP : null;
|
||||
|
||||
List<DnsRecord> resourceRecords = DnsServerController.BuildDnsResourceRecords(
|
||||
dnsRecords, hostName, domain.DomainName, serviceIp);
|
||||
if (string.IsNullOrEmpty(serviceIp))
|
||||
{
|
||||
StringDictionary settings = ServerController.GetServiceSettings(siteItem.ServiceId);
|
||||
if (settings["PublicSharedIP"] != null)
|
||||
serviceIp = settings["PublicSharedIP"].ToString();
|
||||
}
|
||||
|
||||
//filter initiat GlobaDNSRecords list
|
||||
if (ignoreGlobalDNSRecords)
|
||||
{
|
||||
//ignore all other except the host_name record
|
||||
foreach (GlobalDnsRecord r in dnsRecords)
|
||||
{
|
||||
if (rebuild)
|
||||
{
|
||||
if ((r.RecordName + (string.IsNullOrEmpty(r.RecordName) ? domain.ZoneName : "." + domain.ZoneName)) == domain.DomainName) tmpDnsRecords.Add(r);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (r.RecordName == "[host_name]") tmpDnsRecords.Add(r);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
tmpDnsRecords = dnsRecords;
|
||||
|
||||
|
||||
List<DnsRecord> resourceRecords = rebuild ? DnsServerController.BuildDnsResourceRecords(tmpDnsRecords, "", domain.DomainName, serviceIp):
|
||||
DnsServerController.BuildDnsResourceRecords(tmpDnsRecords, hostName, domain.DomainName, serviceIp);
|
||||
|
||||
if (!rebuild)
|
||||
{
|
||||
foreach (DnsRecord r in resourceRecords)
|
||||
{
|
||||
if (r.RecordName != "*")
|
||||
{
|
||||
// check if the web site already exists
|
||||
if (DataProvider.CheckDomain(domain.PackageId, string.IsNullOrEmpty(r.RecordName) ? domain.DomainName : r.RecordName + "." + domain.DomainName, true) != 0)
|
||||
return BusinessErrorCodes.ERROR_WEB_SITE_ALREADY_EXISTS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -807,50 +950,50 @@ namespace WebsitePanel.EnterpriseServer
|
|||
}
|
||||
|
||||
// update host headers
|
||||
if (updateWebSite)
|
||||
{
|
||||
List<ServerBinding> bindings = new List<ServerBinding>();
|
||||
|
||||
// get existing web site bindings
|
||||
WebServer web = new WebServer();
|
||||
ServiceProviderProxy.Init(web, siteItem.ServiceId);
|
||||
|
||||
List<ServerBinding> bindings = new List<ServerBinding>();
|
||||
bindings.AddRange(web.GetSiteBindings(siteItem.SiteId));
|
||||
|
||||
// check if web site has dedicated IP assigned
|
||||
bool dedicatedIp = bindings.Exists(binding => { return String.IsNullOrEmpty(binding.Host) && binding.IP != "*"; });
|
||||
|
||||
// update binding only for "shared" ip addresses
|
||||
if (!dedicatedIp)
|
||||
{
|
||||
// add new host headers
|
||||
string ipAddr = "*";
|
||||
if (ip != null)
|
||||
ipAddr = !String.IsNullOrEmpty(ip.InternalIP) ? ip.InternalIP : ip.ExternalIP;
|
||||
|
||||
// fill bindings
|
||||
FillWebServerBindings(bindings, dnsRecords, ipAddr, hostName, domain.DomainName);
|
||||
if (rebuild)
|
||||
FillWebServerBindings(bindings, dnsRecords, "", domain.DomainName, "", ignoreGlobalDNSRecords);
|
||||
else
|
||||
FillWebServerBindings(bindings, dnsRecords, ipAddr, hostName, domain.DomainName, ignoreGlobalDNSRecords);
|
||||
|
||||
//for logging purposes
|
||||
foreach (ServerBinding b in bindings)
|
||||
{
|
||||
string header = string.Format("{0} {1} {2}", b.Host, b.IP, b.Port);
|
||||
TaskManager.WriteParameter("Add Binding", b.Host);
|
||||
TaskManager.WriteParameter("Add Binding", header);
|
||||
}
|
||||
|
||||
// update bindings
|
||||
web.UpdateSiteBindings(siteItem.SiteId, bindings.ToArray());
|
||||
}
|
||||
}
|
||||
if (updateWebSite)
|
||||
web.UpdateSiteBindings(siteItem.SiteId, bindings.ToArray(), false);
|
||||
|
||||
// update domain
|
||||
if (!rebuild)
|
||||
{
|
||||
domain.WebSiteId = siteItemId;
|
||||
//ServerController.UpdateDomain(domain);
|
||||
if (!String.IsNullOrEmpty(hostName))
|
||||
domain.DomainName = hostName + "." + domain.DomainName;
|
||||
else
|
||||
domain.DomainName = domain.DomainName;
|
||||
domain.IsDomainPointer = true;
|
||||
foreach (ServerBinding b in bindings)
|
||||
{
|
||||
//add new domain record
|
||||
domain.DomainName = b.Host;
|
||||
int domainID = ServerController.AddDomain(domain);
|
||||
|
||||
DomainInfo domainTmp = ServerController.GetDomain(domainID);
|
||||
if (domainTmp != null)
|
||||
{
|
||||
|
@ -858,7 +1001,8 @@ namespace WebsitePanel.EnterpriseServer
|
|||
domainTmp.ZoneItemId = domain.ZoneItemId;
|
||||
ServerController.UpdateDomain(domainTmp);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -874,10 +1018,10 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
public static int DeleteWebSitePointer(int siteItemId, int domainId)
|
||||
{
|
||||
return DeleteWebSitePointer(siteItemId, domainId, true);
|
||||
return DeleteWebSitePointer(siteItemId, domainId, true, true, true);
|
||||
}
|
||||
|
||||
public static int DeleteWebSitePointer(int siteItemId, int domainId, bool updateWebSite)
|
||||
public static int DeleteWebSitePointer(int siteItemId, int domainId, bool updateWebSite, bool ignoreGlobalDNSRecords, bool deleteDomainsRecord)
|
||||
{
|
||||
// check account
|
||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||
|
@ -906,16 +1050,36 @@ namespace WebsitePanel.EnterpriseServer
|
|||
TaskManager.StartTask("WEB_SITE", "DELETE_POINTER", siteItem.Name);
|
||||
TaskManager.ItemId = siteItemId;
|
||||
TaskManager.WriteParameter("Domain pointer", domain.DomainName);
|
||||
TaskManager.WriteParameter("updateWebSite", updateWebSite.ToString());
|
||||
|
||||
try
|
||||
{
|
||||
if (zone != null)
|
||||
{
|
||||
// change DNS zone
|
||||
List<GlobalDnsRecord> tmpDnsRecords = new List<GlobalDnsRecord>();
|
||||
|
||||
string serviceIp = (ip != null) ? ip.ExternalIP : null;
|
||||
|
||||
if (string.IsNullOrEmpty(serviceIp))
|
||||
{
|
||||
StringDictionary settings = ServerController.GetServiceSettings(siteItem.ServiceId);
|
||||
if (settings["PublicSharedIP"] != null)
|
||||
serviceIp = settings["PublicSharedIP"].ToString();
|
||||
}
|
||||
|
||||
if (ignoreGlobalDNSRecords)
|
||||
{
|
||||
foreach (GlobalDnsRecord r in dnsRecords)
|
||||
{
|
||||
if ((r.RecordName == "[host_name]") | ((r.RecordName + (string.IsNullOrEmpty(r.RecordName) ? domain.ZoneName : "." + domain.ZoneName)) == domain.DomainName))
|
||||
tmpDnsRecords.Add(r);
|
||||
}
|
||||
}
|
||||
else tmpDnsRecords = dnsRecords;
|
||||
|
||||
List<DnsRecord> resourceRecords = DnsServerController.BuildDnsResourceRecords(
|
||||
dnsRecords, domain.DomainName, "", serviceIp);
|
||||
tmpDnsRecords, domain.DomainName, "", serviceIp);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -929,8 +1093,6 @@ namespace WebsitePanel.EnterpriseServer
|
|||
}
|
||||
}
|
||||
|
||||
if (updateWebSite)
|
||||
{
|
||||
// get existing web site bindings
|
||||
WebServer web = new WebServer();
|
||||
ServiceProviderProxy.Init(web, siteItem.ServiceId);
|
||||
|
@ -942,11 +1104,10 @@ namespace WebsitePanel.EnterpriseServer
|
|||
bool dedicatedIp = bindings.Exists(binding => { return String.IsNullOrEmpty(binding.Host) && binding.IP != "*"; });
|
||||
|
||||
// update binding only for "shared" ip addresses
|
||||
if (!dedicatedIp)
|
||||
{
|
||||
|
||||
// remove host headers
|
||||
List<ServerBinding> domainBindings = new List<ServerBinding>();
|
||||
FillWebServerBindings(domainBindings, dnsRecords, "", domain.DomainName, "");
|
||||
FillWebServerBindings(domainBindings, dnsRecords, "", domain.DomainName, "", ignoreGlobalDNSRecords);
|
||||
|
||||
// fill to remove list
|
||||
List<string> headersToRemove = new List<string>();
|
||||
|
@ -957,15 +1118,16 @@ namespace WebsitePanel.EnterpriseServer
|
|||
bindings.RemoveAll(b => { return headersToRemove.Contains(b.Host) && b.Port == "80"; } );
|
||||
|
||||
// update bindings
|
||||
web.UpdateSiteBindings(siteItem.SiteId, bindings.ToArray());
|
||||
}
|
||||
}
|
||||
if (updateWebSite)
|
||||
web.UpdateSiteBindings(siteItem.SiteId, bindings.ToArray(), true);
|
||||
|
||||
// update domain
|
||||
domain.WebSiteId = 0;
|
||||
if (deleteDomainsRecord)
|
||||
{
|
||||
ServerController.UpdateDomain(domain);
|
||||
ServerController.DeleteDomain(domain.DomainId);
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
|
@ -1,56 +1,56 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<section name="microsoft.web.services3" type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration, Microsoft.Web.Services3"/>
|
||||
<section name="microsoft.web.services3" type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration, Microsoft.Web.Services3" />
|
||||
</configSections>
|
||||
<!-- Connection strings -->
|
||||
<connectionStrings>
|
||||
<add name="EnterpriseServer" connectionString="server=localhost\sqlexpress;database=WebsitePanelBeta;uid=WebsitePanel;pwd=bdeznsrsyce58m0bc61j;" providerName="System.Data.SqlClient"/>
|
||||
<add name="EnterpriseServer" connectionString="server=HSTPROV01;database=WebsitePanelMerge;uid=WebsitePanel;pwd=aj7ep6fyhmw3b5qeth7c;" providerName="System.Data.SqlClient" />
|
||||
</connectionStrings>
|
||||
<appSettings>
|
||||
<!-- Encryption util settings -->
|
||||
<add key="WebsitePanel.CryptoKey" value="84lc71526qnp8mlqx0gk"/>
|
||||
<add key="WebsitePanel.CryptoKey" value="3x7eqt7zabc5n5afs6dg" />
|
||||
<!-- A1D4KDHUE83NKHddF -->
|
||||
<add key="WebsitePanel.EncryptionEnabled" value="true"/>
|
||||
<add key="WebsitePanel.EncryptionEnabled" value="true" />
|
||||
<!-- Web Applications -->
|
||||
<add key="WebsitePanel.EnterpriseServer.WebApplicationsPath" value="~/WebApplications"/>
|
||||
<add key="WebsitePanel.EnterpriseServer.WebApplicationsPath" value="~/WebApplications" />
|
||||
<!-- Communication settings -->
|
||||
<!-- Maximum waiting time when sending request to the remote server
|
||||
The value is in seconds. "-1" - infinite. -->
|
||||
<add key="WebsitePanel.EnterpriseServer.ServerRequestTimeout" value="3600"/>
|
||||
<add key="WebsitePanel.EnterpriseServer.ServerRequestTimeout" value="3600" />
|
||||
</appSettings>
|
||||
<system.web>
|
||||
<!-- Disable any authentication -->
|
||||
<authentication mode="None"/>
|
||||
<authentication mode="None" />
|
||||
<!-- Correct HTTP runtime settings -->
|
||||
<httpRuntime executionTimeout="3600" maxRequestLength="16384"/>
|
||||
<httpRuntime executionTimeout="3600" maxRequestLength="16384" />
|
||||
<!-- Set globalization settings -->
|
||||
<globalization culture="en-US" uiCulture="en" requestEncoding="UTF-8" responseEncoding="UTF-8" fileEncoding="UTF-8"/>
|
||||
<globalization culture="en-US" uiCulture="en" requestEncoding="UTF-8" responseEncoding="UTF-8" fileEncoding="UTF-8" />
|
||||
<!-- Web Services settings -->
|
||||
<webServices>
|
||||
<protocols>
|
||||
<remove name="HttpPost"/>
|
||||
<remove name="HttpPostLocalhost"/>
|
||||
<remove name="HttpGet"/>
|
||||
<remove name="HttpPost" />
|
||||
<remove name="HttpPostLocalhost" />
|
||||
<remove name="HttpGet" />
|
||||
</protocols>
|
||||
<soapServerProtocolFactory type="Microsoft.Web.Services3.WseProtocolFactory, Microsoft.Web.Services3"/>
|
||||
<soapServerProtocolFactory type="Microsoft.Web.Services3.WseProtocolFactory, Microsoft.Web.Services3" />
|
||||
</webServices>
|
||||
<compilation targetFramework="4.0" debug="true"/>
|
||||
<compilation targetFramework="4.0" />
|
||||
</system.web>
|
||||
<!-- WSE 3.0 settings -->
|
||||
<microsoft.web.services3>
|
||||
<diagnostics>
|
||||
<trace enabled="false" input="InputTrace.webinfo" output="OutputTrace.webinfo"/>
|
||||
<trace enabled="false" input="InputTrace.webinfo" output="OutputTrace.webinfo" />
|
||||
</diagnostics>
|
||||
<messaging>
|
||||
<maxMessageLength value="-1"/>
|
||||
<mtom clientMode="On"/>
|
||||
<maxMessageLength value="-1" />
|
||||
<mtom clientMode="On" />
|
||||
</messaging>
|
||||
<security>
|
||||
<securityTokenManager>
|
||||
<add type="WebsitePanel.EnterpriseServer.ServiceUsernameTokenManager, WebsitePanel.EnterpriseServer" namespace="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" localName="UsernameToken"/>
|
||||
<add type="WebsitePanel.EnterpriseServer.ServiceUsernameTokenManager, WebsitePanel.EnterpriseServer" namespace="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" localName="UsernameToken" />
|
||||
</securityTokenManager>
|
||||
</security>
|
||||
<policy fileName="WsePolicyCache.Config"/>
|
||||
<policy fileName="WsePolicyCache.Config" />
|
||||
</microsoft.web.services3>
|
||||
</configuration>
|
|
@ -19,11 +19,6 @@
|
|||
</UpgradeBackupLocation>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile />
|
||||
<UseIISExpress>false</UseIISExpress>
|
||||
<IISExpressSSLPort />
|
||||
<IISExpressAnonymousAuthentication />
|
||||
<IISExpressWindowsAuthentication />
|
||||
<IISExpressUseClassicPipelineMode />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
|
@ -415,7 +410,6 @@
|
|||
<Content Include="esWebApplicationGallery.asmx" />
|
||||
<EmbeddedResource Include="Images\logo.png" />
|
||||
<Content Include="SystemEventHandlers.config" />
|
||||
<None Include="Properties\PublishProfiles\Profile1.pubxml" />
|
||||
<None Include="TaskEventHandlers.config" />
|
||||
<None Include="WsePolicyCache.Config" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
|
||||
namespace WebsitePanel.Providers.OS
|
||||
{
|
||||
|
@ -82,8 +81,5 @@ namespace WebsitePanel.Providers.OS
|
|||
// Synchronizing
|
||||
FolderGraph GetFolderGraph(string path);
|
||||
void ExecuteSyncActions(FileSyncAction[] actions);
|
||||
void SetQuotaLimitOnFolder(string cmdFilePath, string virtualFileClusterName, string folderPath, string quotaLimit, int mode, string wmiUserName, string wmiPassword);
|
||||
void DeleteDirectoryRecursive(string rootPath);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,6 +80,7 @@
|
|||
<Compile Include="HostedSolution\BlackBerryErrorsCodes.cs" />
|
||||
<Compile Include="HostedSolution\BlackBerryStatsItem.cs" />
|
||||
<Compile Include="HostedSolution\BlackBerryUserDeleteState.cs" />
|
||||
<Compile Include="HostedSolution\ExchangeAcceptedDomainType.cs" />
|
||||
<Compile Include="HostedSolution\ExchangeMailboxPlanType.cs" />
|
||||
<Compile Include="HostedSolution\ExchangeMailboxPlan.cs" />
|
||||
<Compile Include="HostedSolution\ILyncServer.cs" />
|
||||
|
@ -92,11 +93,6 @@
|
|||
<Compile Include="HostedSolution\LyncUsersPaged.cs" />
|
||||
<Compile Include="HostedSolution\LyncVoicePolicyType.cs" />
|
||||
<Compile Include="HostedSolution\TransactionAction.cs" />
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ResultObjects\HeliconApe.cs" />
|
||||
<Compile Include="HostedSolution\ExchangeMobileDevice.cs" />
|
||||
<Compile Include="HostedSolution\IOCSEdgeServer.cs" />
|
||||
|
@ -317,10 +313,6 @@
|
|||
<Compile Include="Web\WebVirtualDirectory.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Include="WebsitePanel.snk" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -209,17 +209,6 @@ namespace WebsitePanel.Providers.OS
|
|||
SecurityUtils.GrantGroupNtfsPermissions(path, users, resetChildPermissions,
|
||||
ServerSettings, usersOU, null);
|
||||
}
|
||||
|
||||
public virtual void SetQuotaLimitOnFolder(string cmdFilePath, string virtualFileClusterName, string folderPath, string quotaLimit, int mode, string wmiUserName, string wmiPassword)
|
||||
{
|
||||
FileUtils.SetQuotaLimitOnFolder(cmdFilePath, virtualFileClusterName, folderPath, quotaLimit, mode, wmiUserName, wmiPassword);
|
||||
}
|
||||
|
||||
public virtual void DeleteDirectoryRecursive(string rootPath)
|
||||
{
|
||||
FileUtils.DeleteDirectoryRecursive(rootPath);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ODBC DSNs
|
||||
|
|
|
@ -62,10 +62,6 @@ namespace WebsitePanel.Providers.OS {
|
|||
|
||||
private System.Threading.SendOrPostCallback FileExistsOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback SetQuotaLimitOnFolderOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback DeleteDirectoryRecursiveOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback DirectoryExistsOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback GetFileOperationCompleted;
|
||||
|
@ -136,7 +132,6 @@ namespace WebsitePanel.Providers.OS {
|
|||
|
||||
private System.Threading.SendOrPostCallback DeleteDSNOperationCompleted;
|
||||
|
||||
|
||||
/// <remarks/>
|
||||
public OperatingSystem() {
|
||||
this.Url = "http://localhost/Server/OperatingSystem.asmx";
|
||||
|
@ -148,12 +143,6 @@ namespace WebsitePanel.Providers.OS {
|
|||
/// <remarks/>
|
||||
public event FileExistsCompletedEventHandler FileExistsCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
public event SetQuotaLimitOnFolderCompletedEventHandler SetQuotaLimitOnFolderCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
public event DeleteDirectoryRecursiveCompletedEventHandler DeleteDirectoryRecursiveCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
public event DirectoryExistsCompletedEventHandler DirectoryExistsCompleted;
|
||||
|
||||
|
@ -343,107 +332,6 @@ namespace WebsitePanel.Providers.OS {
|
|||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/SetQuotaLimitOnFolder", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
||||
public bool SetQuotaLimitOnFolder(string cmdFilePath, string virtualFileClusterName, string folderPath, string quotaLimit, int mode, string wmiUserName, string wmiPassword)
|
||||
{
|
||||
object[] results = this.Invoke("SetQuotaLimitOnFolder", new object[] {
|
||||
cmdFilePath, virtualFileClusterName, folderPath, quotaLimit, mode, wmiUserName, wmiPassword});
|
||||
return ((bool)(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public System.IAsyncResult BeginSetQuotaLimitOnFolder(string cmdFilePath, string virtualFileClusterName, string folderPath, string quotaLimit, int mode, string wmiUserName, string wmiPassword, System.AsyncCallback callback, object asyncState)
|
||||
{
|
||||
return this.BeginInvoke("SetQuotaLimitOnFolder", new object[] {
|
||||
cmdFilePath, virtualFileClusterName, folderPath, quotaLimit, mode, wmiUserName, wmiPassword}, callback, asyncState);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public bool EndSetQuotaLimitOnFolder(System.IAsyncResult asyncResult)
|
||||
{
|
||||
object[] results = this.EndInvoke(asyncResult);
|
||||
return ((bool)(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void SetQuotaLimitOnFolderAsync(string cmdFilePath, string virtualFileClusterName, string folderPath, string quotaLimit, int mode, string wmiUserName, string wmiPassword)
|
||||
{
|
||||
this.SetQuotaLimitOnFolderAsync(cmdFilePath, virtualFileClusterName, folderPath, quotaLimit, mode, wmiUserName, wmiPassword, null);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void SetQuotaLimitOnFolderAsync(string cmdFilePath, string virtualFileClusterName, string folderPath, string quotaLimit, int mode, string wmiUserName, string wmiPassword, object userState)
|
||||
{
|
||||
if ((this.SetQuotaLimitOnFolderOperationCompleted == null))
|
||||
{
|
||||
this.SetQuotaLimitOnFolderOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetQuotaLimitOnFolderOperationCompleted);
|
||||
}
|
||||
this.InvokeAsync("SetQuotaLimitOnFolder", new object[] {
|
||||
cmdFilePath, virtualFileClusterName, folderPath, quotaLimit, mode, wmiUserName, wmiPassword}, this.SetQuotaLimitOnFolderOperationCompleted, userState);
|
||||
}
|
||||
|
||||
private void OnSetQuotaLimitOnFolderOperationCompleted(object arg)
|
||||
{
|
||||
if ((this.SetQuotaLimitOnFolderCompleted != null))
|
||||
{
|
||||
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
|
||||
this.SetQuotaLimitOnFolderCompleted(this, new SetQuotaLimitOnFolderCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/DeleteDirectoryRecursive", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
||||
public bool DeleteDirectoryRecursive(string rootPath)
|
||||
{
|
||||
object[] results = this.Invoke("DeleteDirectoryRecursive", new object[] {
|
||||
rootPath });
|
||||
return ((bool)(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public System.IAsyncResult BeginDeleteDirectoryRecursive(string rootPath, System.AsyncCallback callback, object asyncState)
|
||||
{
|
||||
return this.BeginInvoke("DeleteDirectoryRecursive", new object[] {
|
||||
rootPath}, callback, asyncState);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public bool EndDeleteDirectoryRecursive(System.IAsyncResult asyncResult)
|
||||
{
|
||||
object[] results = this.EndInvoke(asyncResult);
|
||||
return ((bool)(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void DeleteDirectoryRecursiveAsync(string rootPath)
|
||||
{
|
||||
this.DeleteDirectoryRecursiveAsync(rootPath, null);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void DeleteDirectoryRecursiveAsync(string rootPath, object userState)
|
||||
{
|
||||
if ((this.DeleteDirectoryRecursiveOperationCompleted == null))
|
||||
{
|
||||
this.DeleteDirectoryRecursiveOperationCompleted = new System.Threading.SendOrPostCallback(this.OnDeleteDirectoryRecursiveOperationCompleted);
|
||||
}
|
||||
this.InvokeAsync("DeleteDirectoryRecursive", new object[] {
|
||||
rootPath}, this.DeleteDirectoryRecursiveOperationCompleted, userState);
|
||||
}
|
||||
|
||||
private void OnDeleteDirectoryRecursiveOperationCompleted(object arg)
|
||||
{
|
||||
if ((this.DeleteDirectoryRecursiveCompleted != null))
|
||||
{
|
||||
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
|
||||
this.DeleteDirectoryRecursiveCompleted(this, new DeleteDirectoryRecursiveCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <remarks/>
|
||||
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/DirectoryExists", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
||||
|
@ -2012,67 +1900,6 @@ namespace WebsitePanel.Providers.OS {
|
|||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
|
||||
public delegate void SetQuotaLimitOnFolderCompletedEventHandler(object sender, SetQuotaLimitOnFolderCompletedEventArgs e);
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
|
||||
[System.Diagnostics.DebuggerStepThroughAttribute()]
|
||||
[System.ComponentModel.DesignerCategoryAttribute("code")]
|
||||
public partial class SetQuotaLimitOnFolderCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
|
||||
{
|
||||
|
||||
private object[] results;
|
||||
|
||||
internal SetQuotaLimitOnFolderCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
|
||||
base(exception, cancelled, userState)
|
||||
{
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public bool Result
|
||||
{
|
||||
get
|
||||
{
|
||||
this.RaiseExceptionIfNecessary();
|
||||
return ((bool)(this.results[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
|
||||
public delegate void DeleteDirectoryRecursiveCompletedEventHandler(object sender, DeleteDirectoryRecursiveCompletedEventArgs e);
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
|
||||
[System.Diagnostics.DebuggerStepThroughAttribute()]
|
||||
[System.ComponentModel.DesignerCategoryAttribute("code")]
|
||||
public partial class DeleteDirectoryRecursiveCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
|
||||
{
|
||||
|
||||
private object[] results;
|
||||
|
||||
internal DeleteDirectoryRecursiveCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
|
||||
base(exception, cancelled, userState)
|
||||
{
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public bool Result
|
||||
{
|
||||
get
|
||||
{
|
||||
this.RaiseExceptionIfNecessary();
|
||||
return ((bool)(this.results[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
|
||||
public delegate void DirectoryExistsCompletedEventHandler(object sender, DirectoryExistsCompletedEventArgs e);
|
||||
|
|
|
@ -37,7 +37,6 @@ using System.Collections.Generic;
|
|||
using System.Reflection;
|
||||
using Ionic.Zip;
|
||||
using WebsitePanel.Providers.OS;
|
||||
using System.Management;
|
||||
|
||||
namespace WebsitePanel.Providers.Utils
|
||||
{
|
||||
|
@ -845,126 +844,6 @@ namespace WebsitePanel.Providers.Utils
|
|||
conn, null);
|
||||
cat = null;
|
||||
}
|
||||
|
||||
public static void DeleteDirectoryRecursive(string rootPath)
|
||||
{
|
||||
// This code is done this way to force folder deletion
|
||||
// even if the folder was opened
|
||||
|
||||
DirectoryInfo treeRoot = new DirectoryInfo(rootPath);
|
||||
if (treeRoot.Exists)
|
||||
{
|
||||
|
||||
DirectoryInfo[] dirs = treeRoot.GetDirectories();
|
||||
while (dirs.Length > 0)
|
||||
{
|
||||
foreach (DirectoryInfo dir in dirs)
|
||||
DeleteDirectoryRecursive(dir.FullName);
|
||||
|
||||
dirs = treeRoot.GetDirectories();
|
||||
}
|
||||
|
||||
// DELETE THE FILES UNDER THE CURRENT ROOT
|
||||
string[] files = Directory.GetFiles(treeRoot.FullName);
|
||||
foreach (string file in files)
|
||||
{
|
||||
File.SetAttributes(file, FileAttributes.Normal);
|
||||
File.Delete(file);
|
||||
}
|
||||
|
||||
Directory.Delete(treeRoot.FullName, true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void SetQuotaLimitOnFolder(string cmdFilePath, string virtualFileClusterName, string folderPath, string quotaLimit, int mode, string wmiUserName, string wmiPassword)
|
||||
{
|
||||
try
|
||||
{
|
||||
string[] splits = folderPath.Split('\\');
|
||||
if (splits.Length > 0)
|
||||
{
|
||||
// Creating the BAT file
|
||||
FileStream fs = File.Create(cmdFilePath);
|
||||
if (fs != null)
|
||||
{
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
}
|
||||
|
||||
StreamWriter swr = new StreamWriter(cmdFilePath);
|
||||
|
||||
if (swr != null)
|
||||
{
|
||||
swr.WriteLine(@"cd c:\windows\system32");
|
||||
|
||||
string[] shareDrive = { };
|
||||
string sharePath = String.Empty;
|
||||
|
||||
if (splits.Length > 4)
|
||||
{
|
||||
// Check the share name if it's not an empty string
|
||||
if (splits[3].Length > 0)
|
||||
shareDrive = splits[3].Split('_');
|
||||
|
||||
// Form the share physicalPath
|
||||
if (shareDrive.Length == 2)
|
||||
sharePath = shareDrive[1] + @":\" + splits[3];
|
||||
|
||||
if (splits.Length == 7 && !quotaLimit.Equals(String.Empty))
|
||||
{
|
||||
splits[6] = "wwwroot";
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
// Set
|
||||
case 0: swr.WriteLine(@"dirquota quota add /path:" + sharePath + @"\" + splits[4] + @"\" + splits[5] + @"\" + splits[6] + @" /limit:" + quotaLimit + @" /remote:" + splits[2]);
|
||||
break;
|
||||
|
||||
// Modify
|
||||
case 1: swr.WriteLine(@"dirquota quota modify /path:" + sharePath + @"\" + splits[4] + @"\" + splits[5] + @"\" + splits[6] + @" /limit:" + quotaLimit + @" /remote:" + splits[2]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
swr.Flush();
|
||||
swr.Close();
|
||||
swr.Dispose();
|
||||
}
|
||||
|
||||
ConnectionOptions connOptions = new ConnectionOptions();
|
||||
|
||||
if (wmiUserName.Length > 0)
|
||||
{
|
||||
connOptions.Username = wmiUserName;
|
||||
connOptions.Password = wmiPassword;
|
||||
}
|
||||
|
||||
connOptions.Impersonation = ImpersonationLevel.Impersonate;
|
||||
|
||||
connOptions.EnablePrivileges = true;
|
||||
|
||||
ManagementScope manScope =
|
||||
new ManagementScope(String.Format(@"\\{0}\ROOT\CIMV2", virtualFileClusterName), connOptions);
|
||||
manScope.Connect();
|
||||
|
||||
ObjectGetOptions objectGetOptions = new ObjectGetOptions();
|
||||
ManagementPath managementPath = new ManagementPath("Win32_Process");
|
||||
ManagementClass processClass = new ManagementClass(manScope, managementPath, objectGetOptions);
|
||||
|
||||
ManagementBaseObject inParams = processClass.GetMethodParameters("Create");
|
||||
inParams["CommandLine"] = cmdFilePath;
|
||||
ManagementBaseObject outParams = processClass.InvokeMethod("Create", inParams, null);
|
||||
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
|
||||
#region Advanced Delete
|
||||
/// <summary>
|
||||
/// Deletes the specified file.
|
||||
|
|
|
@ -533,39 +533,6 @@ namespace WebsitePanel.Server
|
|||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[WebMethod, SoapHeader("settings")]
|
||||
public void SetQuotaLimitOnFolder(string cmdFilePath, string virtualFileClusterName, string folderPath, string quotaLimit, int mode, string wmiUserName, string wmiPassword)
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.WriteStart("'{0}' SetQuotaLimitOnFolder", ProviderSettings.ProviderName);
|
||||
OsProvider.SetQuotaLimitOnFolder(cmdFilePath, virtualFileClusterName, folderPath, quotaLimit, mode, wmiUserName, wmiPassword);
|
||||
Log.WriteEnd("'{0}' SetQuotaLimitOnFolder", ProviderSettings.ProviderName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteError(String.Format("'{0}' SetQuotaLimitOnFolder", ProviderSettings.ProviderName), ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[WebMethod, SoapHeader("settings")]
|
||||
public void DeleteDirectoryRecursive(string rootPath)
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.WriteStart("'{0}' DeleteDirectoryRecursive", ProviderSettings.ProviderName);
|
||||
OsProvider.DeleteDirectoryRecursive(rootPath);
|
||||
Log.WriteEnd("'{0}' DeleteDirectoryRecursive", ProviderSettings.ProviderName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteError(String.Format("'{0}' DeleteDirectoryRecursive", ProviderSettings.ProviderName), ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Synchronizing
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
<!-- Perform security check -->
|
||||
<enabled value="true"/>
|
||||
<!-- Server password -->
|
||||
<password value="Ib0S3Bg/dA7nbye3jrOcitlyp1c="/>
|
||||
<password value="W6ph5Mm5Pz8GgiULbPgzG37mj9g="/>
|
||||
</security>
|
||||
</websitepanel.server>
|
||||
<system.web>
|
||||
|
|
|
@ -20,10 +20,6 @@
|
|||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile />
|
||||
<UseIISExpress>false</UseIISExpress>
|
||||
<IISExpressSSLPort />
|
||||
<IISExpressAnonymousAuthentication />
|
||||
<IISExpressWindowsAuthentication />
|
||||
<IISExpressUseClassicPipelineMode />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
|
@ -235,7 +231,6 @@
|
|||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Properties\PublishProfiles\QuotaTestHaya.pubxml" />
|
||||
<None Include="WsePolicyCache.Config" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
|
|
|
@ -241,7 +241,6 @@
|
|||
<Content Include="App_Themes\Default\Common.skin" />
|
||||
<Content Include="App_Themes\Default\DataBoundControls.skin" />
|
||||
<Content Include="App_Themes\Default\Icons.skin" />
|
||||
<None Include="Properties\PublishProfiles\NewPortalFork.pubxml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="App_Containers\Default\TopPane.ascx" />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue