From bb376367d6e3c2ca43e08e2b6125f6955b949f11 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Tue, 26 Jul 2016 16:19:17 +0200 Subject: [PATCH] If the umbracoMigration table does not yet exist, then get the configured version from the web.config and parse it --- .../Install/InstallSteps/UpgradeStep.cs | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web/Install/InstallSteps/UpgradeStep.cs b/src/Umbraco.Web/Install/InstallSteps/UpgradeStep.cs index 42bca03498..5ef2577179 100644 --- a/src/Umbraco.Web/Install/InstallSteps/UpgradeStep.cs +++ b/src/Umbraco.Web/Install/InstallSteps/UpgradeStep.cs @@ -1,3 +1,5 @@ +using System; +using System.Linq; using Semver; using Umbraco.Core; using Umbraco.Core.Configuration; @@ -52,12 +54,35 @@ namespace Umbraco.Web.Install.InstallSteps //If we have a db context available, if we don't then we are not installed anyways if (ApplicationContext.Current.DatabaseContext.IsDatabaseConfigured && ApplicationContext.Current.DatabaseContext.CanConnect) - { version = ApplicationContext.Current.DatabaseContext.ValidateDatabaseSchema().DetermineInstalledVersionByMigrations(ApplicationContext.Current.Services.MigrationEntryService); + + if (version != new SemVersion(0)) + return version; + + // If we aren't able to get a result from the umbracoMigrations table then use the version in web.config, if it's available + if (string.IsNullOrWhiteSpace(GlobalSettings.ConfigurationStatus)) + return version; + + var configuredVersion = GlobalSettings.ConfigurationStatus; + + string currentComment = null; + + var current = configuredVersion.Split('-'); + if (current.Length > 1) + currentComment = current[1]; + + Version currentVersion; + if (Version.TryParse(current[0], out currentVersion)) + { + version = new SemVersion( + currentVersion.Major, + currentVersion.Minor, + currentVersion.Build, + string.IsNullOrWhiteSpace(currentComment) ? null : currentComment, + currentVersion.Revision > 0 ? currentVersion.Revision.ToString() : null); } return version; } - } } \ No newline at end of file