Helicon Ape: avoid copying handlers/modules from ancesor on registration
This commit is contained in:
parent
f3932d59f5
commit
3d8a260895
1 changed files with 43 additions and 17 deletions
|
@ -2254,33 +2254,61 @@ namespace WebsitePanel.Providers.Web
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
using (var srvman = webObjectsSvc.GetServerManager())
|
using (var srvman = webObjectsSvc.GetServerManager())
|
||||||
{
|
{
|
||||||
//
|
|
||||||
Configuration appConfig = srvman.GetApplicationHostConfiguration();
|
Configuration appConfig = srvman.GetApplicationHostConfiguration();
|
||||||
|
|
||||||
// add Helicon.Ape module
|
// add 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();
|
||||||
|
|
||||||
|
/*
|
||||||
|
if ("" != siteId)
|
||||||
|
{
|
||||||
|
// <remove name="Helicon.Ape" />
|
||||||
|
ConfigurationElement removeHeliconApeModuleEntry = modulesCollection.CreateElement("remove");
|
||||||
|
removeHeliconApeModuleEntry["name"] = Constants.HeliconApeModule;
|
||||||
|
modulesCollection.Add(removeHeliconApeModuleEntry);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// add name="Helicon.Ape" />
|
||||||
ConfigurationElement heliconApeModuleEntry = modulesCollection.CreateElement("add");
|
ConfigurationElement heliconApeModuleEntry = modulesCollection.CreateElement("add");
|
||||||
heliconApeModuleEntry["name"] = Constants.HeliconApeModule;
|
heliconApeModuleEntry["name"] = Constants.HeliconApeModule;
|
||||||
heliconApeModuleEntry["type"] = GetHeliconApeModuleType(siteId);
|
heliconApeModuleEntry["type"] = GetHeliconApeModuleType(siteId);
|
||||||
//
|
|
||||||
modulesCollection.AddAt(0, heliconApeModuleEntry);
|
// this way make <clear/> and copy all modules list from ancestor
|
||||||
|
//modulesCollection.AddAt(0, heliconApeModuleEntry);
|
||||||
|
// this way just insert single ape module entry
|
||||||
|
modulesCollection.Add(heliconApeModuleEntry);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// add Helicon.Ape handler
|
// add 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();
|
||||||
|
|
||||||
|
/*
|
||||||
|
if ("" != siteId)
|
||||||
|
{
|
||||||
|
// <remove name="Helicon.Ape" />
|
||||||
|
ConfigurationElement removeHeliconApeHandlerEntry = handlersCollection.CreateElement("remove");
|
||||||
|
removeHeliconApeHandlerEntry["name"] = Constants.HeliconApeModule;
|
||||||
|
handlersCollection.Add(removeHeliconApeHandlerEntry);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// add name="Helicon.Ape" />
|
||||||
ConfigurationElement heliconApeHandlerEntry = handlersCollection.CreateElement("add");
|
ConfigurationElement heliconApeHandlerEntry = handlersCollection.CreateElement("add");
|
||||||
heliconApeHandlerEntry["name"] = Constants.HeliconApeModule;
|
heliconApeHandlerEntry["name"] = Constants.HeliconApeModule;
|
||||||
heliconApeHandlerEntry["type"] = GetHeliconApeHandlerType(siteId);
|
heliconApeHandlerEntry["type"] = GetHeliconApeHandlerType(siteId);
|
||||||
heliconApeHandlerEntry["path"] = Constants.HeliconApeHandlerPath;
|
heliconApeHandlerEntry["path"] = Constants.HeliconApeHandlerPath;
|
||||||
heliconApeHandlerEntry["verb"] = "*";
|
heliconApeHandlerEntry["verb"] = "*";
|
||||||
heliconApeHandlerEntry["resourceType"] = "Unspecified";
|
heliconApeHandlerEntry["resourceType"] = "Unspecified";
|
||||||
//
|
|
||||||
handlersCollection.AddAt(0, heliconApeHandlerEntry);
|
handlersCollection.AddAt(0, heliconApeHandlerEntry);
|
||||||
//
|
|
||||||
srvman.CommitChanges();
|
srvman.CommitChanges();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2304,40 +2332,38 @@ namespace WebsitePanel.Providers.Web
|
||||||
// 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();
|
||||||
ConfigurationElement heliconApeModuleEntry = null;
|
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))
|
if (String.Equals(moduleEntry["name"].ToString(), Constants.HeliconApeModule, StringComparison.InvariantCultureIgnoreCase))
|
||||||
{
|
{
|
||||||
heliconApeModuleEntry = moduleEntry;
|
heliconApeModuleEntriesList.Add(moduleEntry);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (heliconApeModuleEntry != null)
|
foreach (ConfigurationElement heliconApeElement in heliconApeModuleEntriesList)
|
||||||
{
|
{
|
||||||
modulesCollection.Remove(heliconApeModuleEntry);
|
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();
|
||||||
ConfigurationElement heliconApeHandlerEntry = null;
|
List<ConfigurationElement> heliconApeHandlerEntriesList = new List<ConfigurationElement>();
|
||||||
foreach (ConfigurationElement handlerEntry in handlersCollection)
|
foreach (ConfigurationElement handlerEntry in handlersCollection)
|
||||||
{
|
{
|
||||||
if (String.Equals(handlerEntry["path"].ToString(), Constants.HeliconApeHandlerPath, StringComparison.InvariantCultureIgnoreCase))
|
if (String.Equals(handlerEntry["name"].ToString(), Constants.HeliconApeModule, StringComparison.InvariantCultureIgnoreCase))
|
||||||
{
|
{
|
||||||
heliconApeHandlerEntry = handlerEntry;
|
heliconApeHandlerEntriesList.Add(handlerEntry);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
if (heliconApeHandlerEntry != null)
|
foreach (ConfigurationElement heliconApeHandlerEntry in heliconApeHandlerEntriesList)
|
||||||
{
|
{
|
||||||
handlersCollection.Remove(heliconApeHandlerEntry);
|
handlersCollection.Remove(heliconApeHandlerEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
// commit changes to metabase
|
// commit changes to metabase
|
||||||
if (heliconApeModuleEntry != null || heliconApeHandlerEntry != null)
|
if (heliconApeModuleEntriesList.Count > 0 || heliconApeHandlerEntriesList.Count > 0)
|
||||||
{
|
{
|
||||||
srvman.CommitChanges();
|
srvman.CommitChanges();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue