Registration of Ape - fixed
This commit is contained in:
parent
e28411b9c7
commit
c205e3d6e4
1 changed files with 78 additions and 30 deletions
|
@ -104,8 +104,11 @@ namespace WebsitePanel.Providers.Web
|
||||||
public const string HeliconApeModulePrevName = "Helicon Ape";
|
public const string HeliconApeModulePrevName = "Helicon Ape";
|
||||||
// true module name
|
// true module name
|
||||||
public const string HeliconApeModule = "Helicon.Ape";
|
public const string HeliconApeModule = "Helicon.Ape";
|
||||||
|
public const string HeliconApeModuleType = "Helicon.Ape.ApeModule";
|
||||||
// true handler name
|
// true handler name
|
||||||
public const string HeliconApeHandler = "Helicon.Ape Handler";
|
public const string HeliconApeHandler = "Helicon.Ape Handler";
|
||||||
|
public const string HeliconApeHandlerType = "Helicon.Ape.Handler";
|
||||||
|
|
||||||
public const string HeliconApeHandlerPath = "*.apehandler";
|
public const string HeliconApeHandlerPath = "*.apehandler";
|
||||||
|
|
||||||
public const string IsapiModule = "IsapiModule";
|
public const string IsapiModule = "IsapiModule";
|
||||||
|
@ -2330,57 +2333,102 @@ namespace WebsitePanel.Providers.Web
|
||||||
|
|
||||||
using (var srvman = webObjectsSvc.GetServerManager())
|
using (var srvman = webObjectsSvc.GetServerManager())
|
||||||
{
|
{
|
||||||
|
bool alterConfiguration = false;
|
||||||
//
|
//
|
||||||
Configuration appConfig = srvman.GetApplicationHostConfiguration();
|
Configuration appConfig = srvman.GetApplicationHostConfiguration();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// remove Helicon.Ape module
|
// remove Helicon.Ape module
|
||||||
ConfigurationSection modulesSection = appConfig.GetSection(Constants.ModulesSection, siteId);
|
ConfigurationSection modulesSection = appConfig.GetSection(Constants.ModulesSection, siteId);
|
||||||
ConfigurationElementCollection modulesCollection = modulesSection.GetCollection();
|
ConfigurationElementCollection modulesCollection = modulesSection.GetCollection();
|
||||||
List<ConfigurationElement> heliconApeModuleEntriesList = new List<ConfigurationElement>();
|
//List<ConfigurationElement> heliconApeModuleEntriesList = new List<ConfigurationElement>();
|
||||||
foreach (ConfigurationElement moduleEntry in modulesCollection)
|
//foreach (ConfigurationElement moduleEntry in modulesCollection)
|
||||||
|
//{
|
||||||
|
// if (
|
||||||
|
// String.Equals(moduleEntry["name"].ToString(), Constants.HeliconApeModule, StringComparison.InvariantCultureIgnoreCase)
|
||||||
|
// ||
|
||||||
|
// String.Equals(moduleEntry["name"].ToString(), Constants.HeliconApeModulePrevName, StringComparison.InvariantCultureIgnoreCase)
|
||||||
|
// )
|
||||||
|
// {
|
||||||
|
// heliconApeModuleEntriesList.Add(moduleEntry);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//foreach (ConfigurationElement heliconApeElement in heliconApeModuleEntriesList)
|
||||||
|
//{
|
||||||
|
// modulesCollection.Remove(heliconApeElement);
|
||||||
|
//}
|
||||||
|
|
||||||
|
for (int i = 0; i < modulesCollection.Count; )
|
||||||
{
|
{
|
||||||
if (
|
ConfigurationElement moduleEntry = modulesCollection[i];
|
||||||
String.Equals(moduleEntry["name"].ToString(), Constants.HeliconApeModule, StringComparison.InvariantCultureIgnoreCase)
|
|
||||||
||
|
string type = moduleEntry["type"].ToString();
|
||||||
String.Equals(moduleEntry["name"].ToString(), Constants.HeliconApeModulePrevName, StringComparison.InvariantCultureIgnoreCase)
|
|
||||||
)
|
if (type.IndexOf(Constants.HeliconApeModuleType, StringComparison.Ordinal) >= 0)
|
||||||
{
|
{
|
||||||
heliconApeModuleEntriesList.Add(moduleEntry);
|
modulesCollection.RemoveAt(i);
|
||||||
|
alterConfiguration = true;
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
foreach (ConfigurationElement heliconApeElement in heliconApeModuleEntriesList)
|
{
|
||||||
{
|
++i;
|
||||||
modulesCollection.Remove(heliconApeElement);
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove Helicon.Ape handler
|
// remove Helicon.Ape handler
|
||||||
ConfigurationSection handlersSection = appConfig.GetSection(Constants.HandlersSection, siteId);
|
ConfigurationSection handlersSection = appConfig.GetSection(Constants.HandlersSection, siteId);
|
||||||
ConfigurationElementCollection handlersCollection = handlersSection.GetCollection();
|
ConfigurationElementCollection handlersCollection = handlersSection.GetCollection();
|
||||||
List<ConfigurationElement> heliconApeHandlerEntriesList = new List<ConfigurationElement>();
|
//List<ConfigurationElement> heliconApeHandlerEntriesList = new List<ConfigurationElement>();
|
||||||
foreach (ConfigurationElement handlerEntry in handlersCollection)
|
//foreach (ConfigurationElement handlerEntry in handlersCollection)
|
||||||
|
//{
|
||||||
|
// if (
|
||||||
|
// String.Equals(handlerEntry["name"].ToString(), Constants.HeliconApeModule, StringComparison.InvariantCultureIgnoreCase)
|
||||||
|
// ||
|
||||||
|
// String.Equals(handlerEntry["name"].ToString(), Constants.HeliconApeModulePrevName, StringComparison.InvariantCultureIgnoreCase)
|
||||||
|
// ||
|
||||||
|
// String.Equals(handlerEntry["name"].ToString(), Constants.HeliconApeHandler, StringComparison.InvariantCultureIgnoreCase)
|
||||||
|
// )
|
||||||
|
// {
|
||||||
|
// heliconApeHandlerEntriesList.Add(handlerEntry);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
////
|
||||||
|
//foreach (ConfigurationElement heliconApeHandlerEntry in heliconApeHandlerEntriesList)
|
||||||
|
//{
|
||||||
|
// handlersCollection.Remove(heliconApeHandlerEntry);
|
||||||
|
//}
|
||||||
|
|
||||||
|
//// commit changes to metabase
|
||||||
|
//if (heliconApeModuleEntriesList.Count > 0 || heliconApeHandlerEntriesList.Count > 0)
|
||||||
|
//{
|
||||||
|
// srvman.CommitChanges();
|
||||||
|
//}
|
||||||
|
|
||||||
|
for (int i = 0; i < handlersCollection.Count; )
|
||||||
{
|
{
|
||||||
if (
|
|
||||||
String.Equals(handlerEntry["name"].ToString(), Constants.HeliconApeModule, StringComparison.InvariantCultureIgnoreCase)
|
string type = handlersCollection[i]["type"].ToString();
|
||||||
||
|
|
||||||
String.Equals(handlerEntry["name"].ToString(), Constants.HeliconApeModulePrevName, StringComparison.InvariantCultureIgnoreCase)
|
if (type.IndexOf(Constants.HeliconApeHandlerType, StringComparison.Ordinal) >= 0)
|
||||||
||
|
|
||||||
String.Equals(handlerEntry["name"].ToString(), Constants.HeliconApeHandler, StringComparison.InvariantCultureIgnoreCase)
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
heliconApeHandlerEntriesList.Add(handlerEntry);
|
handlersCollection.RemoveAt(i);
|
||||||
|
alterConfiguration = true;
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
//
|
{
|
||||||
foreach (ConfigurationElement heliconApeHandlerEntry in heliconApeHandlerEntriesList)
|
++i;
|
||||||
{
|
}
|
||||||
handlersCollection.Remove(heliconApeHandlerEntry);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// commit changes to metabase
|
if (alterConfiguration)
|
||||||
if (heliconApeModuleEntriesList.Count > 0 || heliconApeHandlerEntriesList.Count > 0)
|
|
||||||
{
|
{
|
||||||
srvman.CommitChanges();
|
srvman.CommitChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue