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(); 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();
}
}
} }
} }

View file

@ -157,11 +157,11 @@ namespace WebsitePanel.EnterpriseServer
public static int AddWebSite(int packageId, string hostName, int domainId, int ipAddressId) 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, public static int AddWebSite(int packageId, string hostName, int domainId, int packageAddressId,
bool addInstantAlias) bool addInstantAlias, bool ignoreGlobalDNSRecords)
{ {
// check account // check account
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive); int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
@ -180,12 +180,15 @@ namespace WebsitePanel.EnterpriseServer
DomainInfo domain = ServerController.GetDomain(domainId); DomainInfo domain = ServerController.GetDomain(domainId);
string domainName = domain.DomainName; string domainName = domain.DomainName;
// check if the web site already exists string siteName = string.IsNullOrEmpty(hostName) ? domainName : hostName + "." + domainName;
if (PackageController.GetPackageItemByName(packageId, domainName, typeof(WebSite)) != null)
// check if the web site already exists (legacy)
if (PackageController.GetPackageItemByName(packageId, siteName, typeof(WebSite)) != null)
return BusinessErrorCodes.ERROR_WEB_SITE_ALREADY_EXISTS; 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 // place log record
TaskManager.StartTask("WEB_SITE", "ADD", siteName); TaskManager.StartTask("WEB_SITE", "ADD", siteName);
@ -198,7 +201,7 @@ namespace WebsitePanel.EnterpriseServer
if (serviceId == 0) if (serviceId == 0)
return BusinessErrorCodes.ERROR_WEB_SITE_SERVICE_UNAVAILABLE; return BusinessErrorCodes.ERROR_WEB_SITE_SERVICE_UNAVAILABLE;
#region Fix for bug #587
// Initialize IIS provider webservice proxy // Initialize IIS provider webservice proxy
WebServer web = new WebServer(); WebServer web = new WebServer();
ServiceProviderProxy.Init(web, serviceId); ServiceProviderProxy.Init(web, serviceId);
@ -216,7 +219,6 @@ namespace WebsitePanel.EnterpriseServer
// Return generic operation failed error // Return generic operation failed error
return BusinessErrorCodes.FAILED_EXECUTE_SERVICE_OPERATION; return BusinessErrorCodes.FAILED_EXECUTE_SERVICE_OPERATION;
} }
#endregion
// load web settings // load web settings
StringDictionary webSettings = ServerController.GetServiceSettings(serviceId); StringDictionary webSettings = ServerController.GetServiceSettings(serviceId);
@ -240,13 +242,6 @@ namespace WebsitePanel.EnterpriseServer
if (ip != null) if (ip != null)
ipAddr = !String.IsNullOrEmpty(ip.InternalIP) ? ip.InternalIP : ip.ExternalIP; 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 // load web DNS records
List<GlobalDnsRecord> dnsRecords = ServerController.GetDnsRecordsByService(serviceId); List<GlobalDnsRecord> dnsRecords = ServerController.GetDnsRecordsByService(serviceId);
@ -254,26 +249,15 @@ namespace WebsitePanel.EnterpriseServer
// prepare site bindings // prepare site bindings
List<ServerBinding> bindings = new List<ServerBinding>(); List<ServerBinding> bindings = new List<ServerBinding>();
if (!dedicatedIp) // SHARED IP
{ // fill main domain bindings
// SHARED IP FillWebServerBindings(bindings, dnsRecords, ipAddr, hostName, domain.DomainName, ignoreGlobalDNSRecords);
// fill main domain bindings
/*
FillWebServerBindings(bindings, dnsRecords, ipAddr, domain.DomainName);
// fill alias bindings if required //double check all bindings
if (addInstantAlias && !String.IsNullOrEmpty(instantAlias)) 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 if (DataProvider.CheckDomain(domain.PackageId, b.Host, true) != 0)
bindings.Add(new ServerBinding(ipAddr, "80", "")); return BusinessErrorCodes.ERROR_WEB_SITE_ALREADY_EXISTS;
} }
UserInfo user = PackageController.GetPackageOwner(packageId); UserInfo user = PackageController.GetPackageOwner(packageId);
@ -327,12 +311,10 @@ namespace WebsitePanel.EnterpriseServer
site.EnableParentPaths = Utils.ParseBool(webPolicy["EnableParentPaths"], false); site.EnableParentPaths = Utils.ParseBool(webPolicy["EnableParentPaths"], false);
site.DedicatedApplicationPool = Utils.ParseBool(webPolicy["EnableDedicatedPool"], false); site.DedicatedApplicationPool = Utils.ParseBool(webPolicy["EnableDedicatedPool"], false);
#region Fix for bug: #1556
// Ensure the website meets hosting plan quotas // Ensure the website meets hosting plan quotas
QuotaValueInfo quotaInfo = PackageController.GetPackageQuota(packageId, Quotas.WEB_APPPOOLS); QuotaValueInfo quotaInfo = PackageController.GetPackageQuota(packageId, Quotas.WEB_APPPOOLS);
site.DedicatedApplicationPool = site.DedicatedApplicationPool && (quotaInfo.QuotaAllocatedValue > 0); site.DedicatedApplicationPool = site.DedicatedApplicationPool && (quotaInfo.QuotaAllocatedValue > 0);
#endregion
site.EnableAnonymousAccess = Utils.ParseBool(webPolicy["EnableAnonymousAccess"], false); site.EnableAnonymousAccess = Utils.ParseBool(webPolicy["EnableAnonymousAccess"], false);
site.EnableWindowsAuthentication = Utils.ParseBool(webPolicy["EnableWindowsAuthentication"], false); site.EnableWindowsAuthentication = Utils.ParseBool(webPolicy["EnableWindowsAuthentication"], false);
@ -377,9 +359,6 @@ namespace WebsitePanel.EnterpriseServer
// CREATE WEB SITE // CREATE WEB SITE
siteId = web.CreateSite(site); siteId = web.CreateSite(site);
// Set hard quota on the website content folder
FilesController.SetFolderQuota(packageId, site.DataPath);
// register item // register item
site.ServiceId = serviceId; site.ServiceId = serviceId;
site.PackageId = packageId; site.PackageId = packageId;
@ -395,14 +374,9 @@ namespace WebsitePanel.EnterpriseServer
// update domain // update domain
// add main pointer // 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 // add parking page
// load package // load package
if (webPolicy["AddParkingPage"] != null) if (webPolicy["AddParkingPage"] != null)
@ -577,36 +551,26 @@ namespace WebsitePanel.EnterpriseServer
// remove all web site pointers // remove all web site pointers
List<DomainInfo> pointers = GetWebSitePointers(siteItemId); List<DomainInfo> pointers = GetWebSitePointers(siteItemId);
foreach (DomainInfo pointer in pointers) foreach (DomainInfo pointer in pointers)
DeleteWebSitePointer(siteItemId, pointer.DomainId, false); DeleteWebSitePointer(siteItemId, pointer.DomainId, false, true, true);
// remove web site main pointer // remove web site main pointer
DomainInfo domain = ServerController.GetDomain(siteItem.Name); DomainInfo domain = ServerController.GetDomain(siteItem.Name);
if(domain != null) if(domain != null)
DeleteWebSitePointer(siteItemId, domain.DomainId, false); DeleteWebSitePointer(siteItemId, domain.DomainId, false, true, true);
// delete web site // delete web site
WebServer web = new WebServer(); WebServer web = new WebServer();
ServiceProviderProxy.Init(web, siteItem.ServiceId); ServiceProviderProxy.Init(web, siteItem.ServiceId);
#region Fix for bug #710
// //
if (web.IsFrontPageSystemInstalled() && web.IsFrontPageInstalled(siteItem.SiteId)) if (web.IsFrontPageSystemInstalled() && web.IsFrontPageInstalled(siteItem.SiteId))
{ {
web.UninstallFrontPage(siteItem.SiteId, siteItem.FrontPageAccount); web.UninstallFrontPage(siteItem.SiteId, siteItem.FrontPageAccount);
} }
#endregion
// //
web.DeleteSite(siteItem.SiteId); 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 // delete service item
PackageController.DeletePackageItem(siteItemId); 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, 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 // TODO test if IPv6 works
{ {
int bindingsCount = bindings.Count; int bindingsCount = bindings.Count;
@ -632,36 +707,46 @@ namespace WebsitePanel.EnterpriseServer
if ((dnsRecord.RecordType == "A" || dnsRecord.RecordType == "AAAA" || dnsRecord.RecordType == "CNAME") && if ((dnsRecord.RecordType == "A" || dnsRecord.RecordType == "AAAA" || dnsRecord.RecordType == "CNAME") &&
dnsRecord.RecordName != "*") dnsRecord.RecordName != "*")
{ {
/* string recordData = Utils.ReplaceStringVariable(dnsRecord.RecordName, "host_name", hostName, true);
string recordData = dnsRecord.RecordName +
((dnsRecord.RecordName != "") ? "." : "") + domainName;
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)) if (ignoreGlobalDNSRecords)
tmpName = Utils.ReplaceStringVariable(dnsRecord.RecordName, "host_name", hostName); {
//only look for the host_nanme record, ignore all others
string recordData = string.Empty; if (dnsRecord.RecordName == "[host_name]")
if (tmpName.Contains(".")) {
recordData = hostName; AddBinding(bindings, new ServerBinding(ipAddr, "80", recordData));
break;
}
}
else else
recordData = tmpName + ((tmpName != "") ? "." : "") + domainName; {
AddBinding(bindings, new ServerBinding(ipAddr, "80", recordData));
bindings.Add(new ServerBinding(ipAddr, "80", recordData)); }
} }
} }
/* if ((bindings.Count == bindingsCount) | (bindings.Count == 0))
if(bindings.Count == bindingsCount)
{ {
bindings.Add(new ServerBinding(ipAddr, "80", domainName)); AddBinding(bindings, new ServerBinding(ipAddr, "80", string.IsNullOrEmpty(hostName) ? domainName : hostName + "." + domainName));
bindings.Add(new ServerBinding(ipAddr, "80", "www." + 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) private static string GetWebSiteUsername(UserSettings webPolicy, string domainName)
{ {
UsernamePolicy policy = new UsernamePolicy(webPolicy["AnonymousAccountPolicy"]); UsernamePolicy policy = new UsernamePolicy(webPolicy["AnonymousAccountPolicy"]);
@ -747,10 +832,15 @@ namespace WebsitePanel.EnterpriseServer
public static int AddWebSitePointer(int siteItemId, string hostName, int domainId) 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) 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 // check account
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive); int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
@ -766,6 +856,13 @@ namespace WebsitePanel.EnterpriseServer
if (domain == null) if (domain == null)
return BusinessErrorCodes.ERROR_DOMAIN_PACKAGE_ITEM_NOT_FOUND; 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 // get zone records for the service
List<GlobalDnsRecord> dnsRecords = ServerController.GetDnsRecordsByService(siteItem.ServiceId); List<GlobalDnsRecord> dnsRecords = ServerController.GetDnsRecordsByService(siteItem.ServiceId);
@ -781,16 +878,62 @@ namespace WebsitePanel.EnterpriseServer
try try
{ {
// load appropriate zone // load appropriate zone
DnsZone zone = (DnsZone)PackageController.GetPackageItem(domain.ZoneItemId); DnsZone zone = (DnsZone)PackageController.GetPackageItem(domain.ZoneItemId);
if (zone != null) if (zone != null)
{ {
// change DNS zone // change DNS zone
List<GlobalDnsRecord> tmpDnsRecords = new List<GlobalDnsRecord>();
string serviceIp = (ip != null) ? ip.ExternalIP : null; string serviceIp = (ip != null) ? ip.ExternalIP : null;
List<DnsRecord> resourceRecords = DnsServerController.BuildDnsResourceRecords( if (string.IsNullOrEmpty(serviceIp))
dnsRecords, hostName, domain.DomainName, 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 try
{ {
@ -807,59 +950,60 @@ namespace WebsitePanel.EnterpriseServer
} }
// update host headers // 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);
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
// add new host headers
string ipAddr = "*";
if (ip != null)
ipAddr = !String.IsNullOrEmpty(ip.InternalIP) ? ip.InternalIP : ip.ExternalIP;
// fill bindings
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)
{ {
// get existing web site bindings string header = string.Format("{0} {1} {2}", b.Host, b.IP, b.Port);
WebServer web = new WebServer(); TaskManager.WriteParameter("Add Binding", header);
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);
foreach (ServerBinding b in bindings)
{
string header = string.Format("{0} {1} {2}", b.Host, b.IP, b.Port);
TaskManager.WriteParameter("Add Binding", b.Host);
}
// update bindings
web.UpdateSiteBindings(siteItem.SiteId, bindings.ToArray());
}
} }
// update bindings
if (updateWebSite)
web.UpdateSiteBindings(siteItem.SiteId, bindings.ToArray(), false);
// update domain // update domain
domain.WebSiteId = siteItemId; if (!rebuild)
//ServerController.UpdateDomain(domain);
if (!String.IsNullOrEmpty(hostName))
domain.DomainName = hostName + "." + domain.DomainName;
else
domain.DomainName = domain.DomainName;
domain.IsDomainPointer = true;
int domainID = ServerController.AddDomain(domain);
DomainInfo domainTmp = ServerController.GetDomain(domainID);
if (domainTmp != null)
{ {
domainTmp.WebSiteId = siteItemId; domain.WebSiteId = siteItemId;
domainTmp.ZoneItemId = domain.ZoneItemId; domain.IsDomainPointer = true;
ServerController.UpdateDomain(domainTmp); 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)
{
domainTmp.WebSiteId = siteItemId;
domainTmp.ZoneItemId = domain.ZoneItemId;
ServerController.UpdateDomain(domainTmp);
}
}
} }
return 0; return 0;
} }
catch (Exception ex) catch (Exception ex)
@ -874,10 +1018,10 @@ namespace WebsitePanel.EnterpriseServer
public static int DeleteWebSitePointer(int siteItemId, int domainId) 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 // check account
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive); int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
@ -906,16 +1050,36 @@ namespace WebsitePanel.EnterpriseServer
TaskManager.StartTask("WEB_SITE", "DELETE_POINTER", siteItem.Name); TaskManager.StartTask("WEB_SITE", "DELETE_POINTER", siteItem.Name);
TaskManager.ItemId = siteItemId; TaskManager.ItemId = siteItemId;
TaskManager.WriteParameter("Domain pointer", domain.DomainName); TaskManager.WriteParameter("Domain pointer", domain.DomainName);
TaskManager.WriteParameter("updateWebSite", updateWebSite.ToString());
try try
{ {
if (zone != null) if (zone != null)
{ {
// change DNS zone // change DNS zone
List<GlobalDnsRecord> tmpDnsRecords = new List<GlobalDnsRecord>();
string serviceIp = (ip != null) ? ip.ExternalIP : null; 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( List<DnsRecord> resourceRecords = DnsServerController.BuildDnsResourceRecords(
dnsRecords, domain.DomainName, "", serviceIp); tmpDnsRecords, domain.DomainName, "", serviceIp);
try try
{ {
@ -929,43 +1093,41 @@ namespace WebsitePanel.EnterpriseServer
} }
} }
// 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
// remove host headers
List<ServerBinding> domainBindings = new List<ServerBinding>();
FillWebServerBindings(domainBindings, dnsRecords, "", domain.DomainName, "", ignoreGlobalDNSRecords);
// fill to remove list
List<string> headersToRemove = new List<string>();
foreach (ServerBinding domainBinding in domainBindings)
headersToRemove.Add(domainBinding.Host);
// remove bndings
bindings.RemoveAll(b => { return headersToRemove.Contains(b.Host) && b.Port == "80"; } );
// update bindings
if (updateWebSite) if (updateWebSite)
{ web.UpdateSiteBindings(siteItem.SiteId, bindings.ToArray(), true);
// 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)
{
// remove host headers
List<ServerBinding> domainBindings = new List<ServerBinding>();
FillWebServerBindings(domainBindings, dnsRecords, "", domain.DomainName, "");
// fill to remove list
List<string> headersToRemove = new List<string>();
foreach (ServerBinding domainBinding in domainBindings)
headersToRemove.Add(domainBinding.Host);
// remove bndings
bindings.RemoveAll(b => { return headersToRemove.Contains(b.Host) && b.Port == "80"; } );
// update bindings
web.UpdateSiteBindings(siteItem.SiteId, bindings.ToArray());
}
}
// update domain // update domain
domain.WebSiteId = 0; domain.WebSiteId = 0;
ServerController.UpdateDomain(domain); if (deleteDomainsRecord)
ServerController.DeleteDomain(domain.DomainId); {
ServerController.UpdateDomain(domain);
ServerController.DeleteDomain(domain.DomainId);
}
return 0; return 0;
} }
catch (Exception ex) catch (Exception ex)

View file

@ -1,56 +1,56 @@
<?xml version="1.0"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<configSections> <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> </configSections>
<!-- Connection strings --> <!-- Connection strings -->
<connectionStrings> <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> </connectionStrings>
<appSettings> <appSettings>
<!-- Encryption util settings --> <!-- Encryption util settings -->
<add key="WebsitePanel.CryptoKey" value="84lc71526qnp8mlqx0gk"/> <add key="WebsitePanel.CryptoKey" value="3x7eqt7zabc5n5afs6dg" />
<!-- A1D4KDHUE83NKHddF --> <!-- A1D4KDHUE83NKHddF -->
<add key="WebsitePanel.EncryptionEnabled" value="true"/> <add key="WebsitePanel.EncryptionEnabled" value="true" />
<!-- Web Applications --> <!-- Web Applications -->
<add key="WebsitePanel.EnterpriseServer.WebApplicationsPath" value="~/WebApplications"/> <add key="WebsitePanel.EnterpriseServer.WebApplicationsPath" value="~/WebApplications" />
<!-- Communication settings --> <!-- Communication settings -->
<!-- Maximum waiting time when sending request to the remote server <!-- Maximum waiting time when sending request to the remote server
The value is in seconds. "-1" - infinite. --> The value is in seconds. "-1" - infinite. -->
<add key="WebsitePanel.EnterpriseServer.ServerRequestTimeout" value="3600"/> <add key="WebsitePanel.EnterpriseServer.ServerRequestTimeout" value="3600" />
</appSettings> </appSettings>
<system.web> <system.web>
<!-- Disable any authentication --> <!-- Disable any authentication -->
<authentication mode="None"/> <authentication mode="None" />
<!-- Correct HTTP runtime settings --> <!-- Correct HTTP runtime settings -->
<httpRuntime executionTimeout="3600" maxRequestLength="16384"/> <httpRuntime executionTimeout="3600" maxRequestLength="16384" />
<!-- Set globalization settings --> <!-- 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 --> <!-- Web Services settings -->
<webServices> <webServices>
<protocols> <protocols>
<remove name="HttpPost"/> <remove name="HttpPost" />
<remove name="HttpPostLocalhost"/> <remove name="HttpPostLocalhost" />
<remove name="HttpGet"/> <remove name="HttpGet" />
</protocols> </protocols>
<soapServerProtocolFactory type="Microsoft.Web.Services3.WseProtocolFactory, Microsoft.Web.Services3"/> <soapServerProtocolFactory type="Microsoft.Web.Services3.WseProtocolFactory, Microsoft.Web.Services3" />
</webServices> </webServices>
<compilation targetFramework="4.0" debug="true"/> <compilation targetFramework="4.0" />
</system.web> </system.web>
<!-- WSE 3.0 settings --> <!-- WSE 3.0 settings -->
<microsoft.web.services3> <microsoft.web.services3>
<diagnostics> <diagnostics>
<trace enabled="false" input="InputTrace.webinfo" output="OutputTrace.webinfo"/> <trace enabled="false" input="InputTrace.webinfo" output="OutputTrace.webinfo" />
</diagnostics> </diagnostics>
<messaging> <messaging>
<maxMessageLength value="-1"/> <maxMessageLength value="-1" />
<mtom clientMode="On"/> <mtom clientMode="On" />
</messaging> </messaging>
<security> <security>
<securityTokenManager> <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> </securityTokenManager>
</security> </security>
<policy fileName="WsePolicyCache.Config"/> <policy fileName="WsePolicyCache.Config" />
</microsoft.web.services3> </microsoft.web.services3>
</configuration> </configuration>

View file

@ -19,11 +19,6 @@
</UpgradeBackupLocation> </UpgradeBackupLocation>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
<UseIISExpress>false</UseIISExpress>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@ -415,7 +410,6 @@
<Content Include="esWebApplicationGallery.asmx" /> <Content Include="esWebApplicationGallery.asmx" />
<EmbeddedResource Include="Images\logo.png" /> <EmbeddedResource Include="Images\logo.png" />
<Content Include="SystemEventHandlers.config" /> <Content Include="SystemEventHandlers.config" />
<None Include="Properties\PublishProfiles\Profile1.pubxml" />
<None Include="TaskEventHandlers.config" /> <None Include="TaskEventHandlers.config" />
<None Include="WsePolicyCache.Config" /> <None Include="WsePolicyCache.Config" />
</ItemGroup> </ItemGroup>

View file

@ -28,7 +28,6 @@
using System; using System;
using System.Collections; using System.Collections;
using System.IO;
namespace WebsitePanel.Providers.OS namespace WebsitePanel.Providers.OS
{ {
@ -82,8 +81,5 @@ namespace WebsitePanel.Providers.OS
// Synchronizing // Synchronizing
FolderGraph GetFolderGraph(string path); FolderGraph GetFolderGraph(string path);
void ExecuteSyncActions(FileSyncAction[] actions); void ExecuteSyncActions(FileSyncAction[] actions);
void SetQuotaLimitOnFolder(string cmdFilePath, string virtualFileClusterName, string folderPath, string quotaLimit, int mode, string wmiUserName, string wmiPassword);
void DeleteDirectoryRecursive(string rootPath);
} }
} }

View file

@ -80,6 +80,7 @@
<Compile Include="HostedSolution\BlackBerryErrorsCodes.cs" /> <Compile Include="HostedSolution\BlackBerryErrorsCodes.cs" />
<Compile Include="HostedSolution\BlackBerryStatsItem.cs" /> <Compile Include="HostedSolution\BlackBerryStatsItem.cs" />
<Compile Include="HostedSolution\BlackBerryUserDeleteState.cs" /> <Compile Include="HostedSolution\BlackBerryUserDeleteState.cs" />
<Compile Include="HostedSolution\ExchangeAcceptedDomainType.cs" />
<Compile Include="HostedSolution\ExchangeMailboxPlanType.cs" /> <Compile Include="HostedSolution\ExchangeMailboxPlanType.cs" />
<Compile Include="HostedSolution\ExchangeMailboxPlan.cs" /> <Compile Include="HostedSolution\ExchangeMailboxPlan.cs" />
<Compile Include="HostedSolution\ILyncServer.cs" /> <Compile Include="HostedSolution\ILyncServer.cs" />
@ -92,11 +93,6 @@
<Compile Include="HostedSolution\LyncUsersPaged.cs" /> <Compile Include="HostedSolution\LyncUsersPaged.cs" />
<Compile Include="HostedSolution\LyncVoicePolicyType.cs" /> <Compile Include="HostedSolution\LyncVoicePolicyType.cs" />
<Compile Include="HostedSolution\TransactionAction.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="ResultObjects\HeliconApe.cs" />
<Compile Include="HostedSolution\ExchangeMobileDevice.cs" /> <Compile Include="HostedSolution\ExchangeMobileDevice.cs" />
<Compile Include="HostedSolution\IOCSEdgeServer.cs" /> <Compile Include="HostedSolution\IOCSEdgeServer.cs" />
@ -317,10 +313,6 @@
<Compile Include="Web\WebVirtualDirectory.cs" /> <Compile Include="Web\WebVirtualDirectory.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<None Include="WebsitePanel.snk" /> <None Include="WebsitePanel.snk" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View file

@ -209,17 +209,6 @@ namespace WebsitePanel.Providers.OS
SecurityUtils.GrantGroupNtfsPermissions(path, users, resetChildPermissions, SecurityUtils.GrantGroupNtfsPermissions(path, users, resetChildPermissions,
ServerSettings, usersOU, null); 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 #endregion
#region ODBC DSNs #region ODBC DSNs

View file

@ -61,10 +61,6 @@ namespace WebsitePanel.Providers.OS {
private System.Threading.SendOrPostCallback CreatePackageFolderOperationCompleted; private System.Threading.SendOrPostCallback CreatePackageFolderOperationCompleted;
private System.Threading.SendOrPostCallback FileExistsOperationCompleted; private System.Threading.SendOrPostCallback FileExistsOperationCompleted;
private System.Threading.SendOrPostCallback SetQuotaLimitOnFolderOperationCompleted;
private System.Threading.SendOrPostCallback DeleteDirectoryRecursiveOperationCompleted;
private System.Threading.SendOrPostCallback DirectoryExistsOperationCompleted; private System.Threading.SendOrPostCallback DirectoryExistsOperationCompleted;
@ -135,8 +131,7 @@ namespace WebsitePanel.Providers.OS {
private System.Threading.SendOrPostCallback UpdateDSNOperationCompleted; private System.Threading.SendOrPostCallback UpdateDSNOperationCompleted;
private System.Threading.SendOrPostCallback DeleteDSNOperationCompleted; private System.Threading.SendOrPostCallback DeleteDSNOperationCompleted;
/// <remarks/> /// <remarks/>
public OperatingSystem() { public OperatingSystem() {
this.Url = "http://localhost/Server/OperatingSystem.asmx"; this.Url = "http://localhost/Server/OperatingSystem.asmx";
@ -147,12 +142,6 @@ namespace WebsitePanel.Providers.OS {
/// <remarks/> /// <remarks/>
public event FileExistsCompletedEventHandler FileExistsCompleted; public event FileExistsCompletedEventHandler FileExistsCompleted;
/// <remarks/>
public event SetQuotaLimitOnFolderCompletedEventHandler SetQuotaLimitOnFolderCompleted;
/// <remarks/>
public event DeleteDirectoryRecursiveCompletedEventHandler DeleteDirectoryRecursiveCompleted;
/// <remarks/> /// <remarks/>
public event DirectoryExistsCompletedEventHandler DirectoryExistsCompleted; public event DirectoryExistsCompletedEventHandler DirectoryExistsCompleted;
@ -342,107 +331,6 @@ namespace WebsitePanel.Providers.OS {
this.FileExistsCompleted(this, new FileExistsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); this.FileExistsCompleted(this, new FileExistsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
} }
} }
/// <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/> /// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
@ -2011,67 +1899,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/> /// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]

View file

@ -37,7 +37,6 @@ using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using Ionic.Zip; using Ionic.Zip;
using WebsitePanel.Providers.OS; using WebsitePanel.Providers.OS;
using System.Management;
namespace WebsitePanel.Providers.Utils namespace WebsitePanel.Providers.Utils
{ {
@ -845,126 +844,6 @@ namespace WebsitePanel.Providers.Utils
conn, null); conn, null);
cat = 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 #region Advanced Delete
/// <summary> /// <summary>
/// Deletes the specified file. /// Deletes the specified file.

View file

@ -533,39 +533,6 @@ namespace WebsitePanel.Server
throw; 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 #endregion
#region Synchronizing #region Synchronizing

View file

@ -44,7 +44,7 @@
<!-- Perform security check --> <!-- Perform security check -->
<enabled value="true"/> <enabled value="true"/>
<!-- Server password --> <!-- Server password -->
<password value="Ib0S3Bg/dA7nbye3jrOcitlyp1c="/> <password value="W6ph5Mm5Pz8GgiULbPgzG37mj9g="/>
</security> </security>
</websitepanel.server> </websitepanel.server>
<system.web> <system.web>

View file

@ -20,10 +20,6 @@
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
<UseIISExpress>false</UseIISExpress> <UseIISExpress>false</UseIISExpress>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@ -235,7 +231,6 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Properties\PublishProfiles\QuotaTestHaya.pubxml" />
<None Include="WsePolicyCache.Config" /> <None Include="WsePolicyCache.Config" />
</ItemGroup> </ItemGroup>
<PropertyGroup> <PropertyGroup>

View file

@ -241,7 +241,6 @@
<Content Include="App_Themes\Default\Common.skin" /> <Content Include="App_Themes\Default\Common.skin" />
<Content Include="App_Themes\Default\DataBoundControls.skin" /> <Content Include="App_Themes\Default\DataBoundControls.skin" />
<Content Include="App_Themes\Default\Icons.skin" /> <Content Include="App_Themes\Default\Icons.skin" />
<None Include="Properties\PublishProfiles\NewPortalFork.pubxml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="App_Containers\Default\TopPane.ascx" /> <Content Include="App_Containers\Default\TopPane.ascx" />