From a187888c05ff0bc0680277e396c0550d26749a45 Mon Sep 17 00:00:00 2001 From: feodor_fitsner Date: Tue, 25 Sep 2012 16:54:03 -0700 Subject: [PATCH] Updated 2.0 portal upgrade code to make it idempotent --- .../WebsitePanel.Setup/EnterpriseServer20.cs | 2 +- .../Sources/WebsitePanel.Setup/Portal20.cs | 2 +- .../Sources/WebsitePanel.Setup/Server20.cs | 2 +- .../Wizard/ExpressInstallPage.cs | 18 +++++++++++------- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/WebsitePanel.Installer/Sources/WebsitePanel.Setup/EnterpriseServer20.cs b/WebsitePanel.Installer/Sources/WebsitePanel.Setup/EnterpriseServer20.cs index c8df0677..3f238133 100644 --- a/WebsitePanel.Installer/Sources/WebsitePanel.Setup/EnterpriseServer20.cs +++ b/WebsitePanel.Installer/Sources/WebsitePanel.Setup/EnterpriseServer20.cs @@ -31,7 +31,7 @@ namespace WebsitePanel.Setup { return UpdateBase(obj, minimalInstallerVersion: "2.0.0", - versionToUpgrade: "1.2.1", + versionToUpgrade: "1.2.1,2.0.0", updateSql: true); } } diff --git a/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Portal20.cs b/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Portal20.cs index 2187ba95..ea1728ae 100644 --- a/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Portal20.cs +++ b/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Portal20.cs @@ -31,7 +31,7 @@ namespace WebsitePanel.Setup { return UpdateBase(obj, minimalInstallerVersion: "2.0.0", - versionsToUpgrade: "1.2.1", + versionsToUpgrade: "1.2.1,2.0.0", updateSql: false, versionSpecificAction: new InstallAction(ActionTypes.ConfigureSecureSessionModuleInWebConfig)); } diff --git a/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Server20.cs b/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Server20.cs index 9f0a7988..105c8534 100644 --- a/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Server20.cs +++ b/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Server20.cs @@ -30,7 +30,7 @@ namespace WebsitePanel.Setup { return Server.UpdateBase(obj, minimalInstallerVersion: "2.0.0", - versionToUpgrade: "1.2.1", + versionToUpgrade: "1.2.1,2.0.0", updateSql: false); } } diff --git a/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Wizard/ExpressInstallPage.cs b/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Wizard/ExpressInstallPage.cs index 2542406b..bb0c5e24 100644 --- a/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Wizard/ExpressInstallPage.cs +++ b/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Wizard/ExpressInstallPage.cs @@ -325,12 +325,16 @@ namespace WebsitePanel.Setup if (webServer != null) { - var modules = doc.CreateElement(iis6 ? "httpModules" : "modules"); - webServer.AppendChild(modules); - var sessionModule = doc.CreateElement("add"); - sessionModule.SetAttribute("name", "SecureSession"); - sessionModule.SetAttribute("type", "WebsitePanel.WebPortal.SecureSessionModule"); - modules.AppendChild(sessionModule); + string modulesNodeName = iis6 ? "httpModules" : "modules"; + if (webServer.SelectSingleNode(modulesNodeName + "/add[@name='SecureSession']") == null) + { + var modules = doc.CreateElement(modulesNodeName); + webServer.AppendChild(modules); + var sessionModule = doc.CreateElement("add"); + sessionModule.SetAttribute("name", "SecureSession"); + sessionModule.SetAttribute("type", "WebsitePanel.WebPortal.SecureSessionModule"); + modules.AppendChild(sessionModule); + } } // update /system.web/httpRuntime element @@ -343,7 +347,7 @@ namespace WebsitePanel.Setup // // var appSettings = doc.SelectSingleNode("configuration/appSettings"); - if (appSettings != null) + if (appSettings != null && appSettings.SelectSingleNode("add[@key='SessionValidationKey']") == null) { var sessionKey = doc.CreateElement("add"); sessionKey.SetAttribute("key", "SessionValidationKey");