From 7e489af4c53458c17a6a81654dbbd37de3293329 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Mon, 7 Jan 2013 07:46:59 -0100 Subject: [PATCH 1/3] Fix an error during development where the razor version was ambiguous --- src/Umbraco.Web.UI/web.Template.Debug.config | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Umbraco.Web.UI/web.Template.Debug.config b/src/Umbraco.Web.UI/web.Template.Debug.config index a28a069e17..b7280497f7 100644 --- a/src/Umbraco.Web.UI/web.Template.Debug.config +++ b/src/Umbraco.Web.UI/web.Template.Debug.config @@ -51,6 +51,13 @@ + + + + + + From 759773deee9585bae0f9060178715dc68711ed45 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Mon, 7 Jan 2013 08:55:43 -0100 Subject: [PATCH 2/3] Correct mistake in config transform --- src/Umbraco.Web.UI/web.Template.Debug.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI/web.Template.Debug.config b/src/Umbraco.Web.UI/web.Template.Debug.config index b7280497f7..f9dcde4d78 100644 --- a/src/Umbraco.Web.UI/web.Template.Debug.config +++ b/src/Umbraco.Web.UI/web.Template.Debug.config @@ -52,7 +52,7 @@ + xdt:Locator="Condition(_defaultNamespace:assemblyIdentity[@name='System.Web.WebPages.Razor']])"/> From af4fbba8e8e31b85b3384f48124702d49b4c35c8 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Mon, 7 Jan 2013 09:39:39 -0100 Subject: [PATCH 3/3] Database upgrade check was backwards &some more failsafes for upgrader/installer --- .../Configuration/GlobalSettings.cs | 10 ++++---- .../install/steps/Definitions/Database.cs | 24 +++++-------------- .../install/utills/p.aspx.cs | 16 ++++++++++--- .../BasePages/BasePage.cs | 11 ++++++++- 4 files changed, 34 insertions(+), 27 deletions(-) diff --git a/src/Umbraco.Core/Configuration/GlobalSettings.cs b/src/Umbraco.Core/Configuration/GlobalSettings.cs index bd3cc9c74a..cf0dd1e7d0 100644 --- a/src/Umbraco.Core/Configuration/GlobalSettings.cs +++ b/src/Umbraco.Core/Configuration/GlobalSettings.cs @@ -234,16 +234,16 @@ namespace Umbraco.Core.Configuration var xml = XDocument.Load(fileName, LoadOptions.PreserveWhitespace); var appSettings = xml.Root.Descendants("appSettings").Single(); - var setting = appSettings.Descendants("add").FirstOrDefault(s => s.Attribute("key").Value == key); + if (setting != null) + { setting.Remove(); - - xml.Save(fileName, SaveOptions.DisableFormatting); - ConfigurationManager.RefreshSection("appSettings"); + xml.Save(fileName, SaveOptions.DisableFormatting); + ConfigurationManager.RefreshSection("appSettings"); + } } - private static string GetFullWebConfigFileName() { var webConfig = new WebConfigurationFileMap(); diff --git a/src/Umbraco.Web/umbraco.presentation/install/steps/Definitions/Database.cs b/src/Umbraco.Web/umbraco.presentation/install/steps/Definitions/Database.cs index a11e3be5da..ccd713e78b 100644 --- a/src/Umbraco.Web/umbraco.presentation/install/steps/Definitions/Database.cs +++ b/src/Umbraco.Web/umbraco.presentation/install/steps/Definitions/Database.cs @@ -14,7 +14,7 @@ namespace umbraco.presentation.install.steps.Definitions public override string Name { - get { return "Database"; } + get { return "Database"; } } public override string UserControl @@ -22,7 +22,7 @@ namespace umbraco.presentation.install.steps.Definitions get { return SystemDirectories.Install + "/steps/database.ascx"; } } - + public override bool MoveToNextStepAutomaticly { get @@ -34,22 +34,10 @@ namespace umbraco.presentation.install.steps.Definitions //here we determine if the installer should skip this step... public override bool Completed() { - bool retval = false; - try - { - var configuredVersion = new Version(Umbraco.Core.Configuration.GlobalSettings.ConfigurationStatus); - var targetVersion = UmbracoVersion.Current; - - retval = targetVersion > configuredVersion; - - } catch { - // this step might fail due to missing connectionstring - return false; - } - - return retval; + var configuredVersion = new Version(Umbraco.Core.Configuration.GlobalSettings.ConfigurationStatus); + var targetVersion = UmbracoVersion.Current; + + return targetVersion < configuredVersion; } - - } } \ No newline at end of file diff --git a/src/Umbraco.Web/umbraco.presentation/install/utills/p.aspx.cs b/src/Umbraco.Web/umbraco.presentation/install/utills/p.aspx.cs index eef79a6cc6..d44285e93d 100644 --- a/src/Umbraco.Web/umbraco.presentation/install/utills/p.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/install/utills/p.aspx.cs @@ -1,4 +1,5 @@ using System; +using System.Configuration; using System.Web.Script.Serialization; using System.Web.Script.Services; using System.Web.Services; @@ -60,9 +61,18 @@ namespace umbraco.presentation.install.utills var result = ApplicationContext.Current.DatabaseContext.CreateDatabaseSchemaAndDataOrUpgrade(); - // Remove legacy umbracoDbDsn configuration setting if it exists - Umbraco.Core.Configuration.GlobalSettings.RemoveSetting(Umbraco.Core.Configuration.GlobalSettings.UmbracoConnectionName); - + // Remove legacy umbracoDbDsn configuration setting if it exists and connectionstring also exists + if (ConfigurationManager.ConnectionStrings[Umbraco.Core.Configuration.GlobalSettings.UmbracoConnectionName] != null) + { + Umbraco.Core.Configuration.GlobalSettings.RemoveSetting(Umbraco.Core.Configuration.GlobalSettings.UmbracoConnectionName); + } + else + { + var ex = new ArgumentNullException(string.Format("ConfigurationManager.ConnectionStrings[{0}]", Umbraco.Core.Configuration.GlobalSettings.UmbracoConnectionName), "Install / upgrade did not complete successfully, umbracoDbDSN was not set in the connectionStrings section"); + LogHelper.Error

("", ex); + throw ex; + } + var js = new JavaScriptSerializer(); var jsonResult = js.Serialize(result); return jsonResult; diff --git a/src/umbraco.businesslogic/BasePages/BasePage.cs b/src/umbraco.businesslogic/BasePages/BasePage.cs index c6655d76a6..cc4148a0da 100644 --- a/src/umbraco.businesslogic/BasePages/BasePage.cs +++ b/src/umbraco.businesslogic/BasePages/BasePage.cs @@ -311,9 +311,18 @@ namespace umbraco.BasePages private void DeleteLogin() { - SqlHelper.ExecuteNonQuery( + // Added try-catch in case login doesn't exist in the database + // Either due to old cookie or running multiple sessions on localhost with different port number + try + { + SqlHelper.ExecuteNonQuery( "DELETE FROM umbracoUserLogins WHERE contextId = @contextId", SqlHelper.CreateParameter("@contextId", umbracoUserContextID)); + } + catch (Exception ex) + { + LogHelper.Error(string.Format("Login with contextId {0} didn't exist in the database", umbracoUserContextID), ex); + } } private void UpdateLogin()