From 4cc20efa08d958e16c056639ae44aa6213f8360a Mon Sep 17 00:00:00 2001 From: Morten Christensen Date: Mon, 26 Nov 2012 10:07:08 -0100 Subject: [PATCH] Refactoring usages of CurrentVersion to use Version in GlobalSettings. Completes U4-1160 --- src/Umbraco.Core/ApplicationContext.cs | 2 +- src/Umbraco.Core/Configuration/GlobalSettings.cs | 11 +++++------ src/Umbraco.Tests/Routing/UmbracoModuleTests.cs | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Umbraco.Core/ApplicationContext.cs b/src/Umbraco.Core/ApplicationContext.cs index ef8c7ea340..a096858f90 100644 --- a/src/Umbraco.Core/ApplicationContext.cs +++ b/src/Umbraco.Core/ApplicationContext.cs @@ -90,7 +90,7 @@ namespace Umbraco.Core try { string configStatus = ConfigurationStatus; - string currentVersion = GlobalSettings.CurrentVersion; + string currentVersion = GlobalSettings.Version.ToString(3); if (currentVersion != configStatus) diff --git a/src/Umbraco.Core/Configuration/GlobalSettings.cs b/src/Umbraco.Core/Configuration/GlobalSettings.cs index b9d669038d..5903598d09 100644 --- a/src/Umbraco.Core/Configuration/GlobalSettings.cs +++ b/src/Umbraco.Core/Configuration/GlobalSettings.cs @@ -27,6 +27,7 @@ namespace Umbraco.Core.Configuration #region Private static fields + private static Version _version; private static string _reservedUrlsCache; private static string _reservedPathsCache; private static StartsWithContainer _reservedList = new StartsWithContainer(); @@ -253,7 +254,7 @@ namespace Umbraco.Core.Configuration try { string configStatus = ConfigurationStatus; - string currentVersion = CurrentVersion; + string currentVersion = Version.ToString(3); if (currentVersion != configStatus) @@ -407,16 +408,14 @@ namespace Umbraco.Core.Configuration /// /// Gets the current version of Umbraco. + /// Version class with the specified major, minor, build (Patch), and revision numbers. /// /// - /// CURRENT UMBRACO VERSION ID + /// CURRENT UMBRACO VERSION ID. /// public static Version Version { - get - { - return typeof(GlobalSettings).Assembly.GetName().Version; - } + get { return _version ?? (_version = typeof (GlobalSettings).Assembly.GetName().Version); } } /// diff --git a/src/Umbraco.Tests/Routing/UmbracoModuleTests.cs b/src/Umbraco.Tests/Routing/UmbracoModuleTests.cs index c00e97eb15..78a484e8fd 100644 --- a/src/Umbraco.Tests/Routing/UmbracoModuleTests.cs +++ b/src/Umbraco.Tests/Routing/UmbracoModuleTests.cs @@ -57,7 +57,7 @@ namespace Umbraco.Tests.Routing //create the module _module = new UmbracoModule(); - ConfigurationManager.AppSettings.Set("umbracoConfigurationStatus", Umbraco.Core.Configuration.GlobalSettings.CurrentVersion); + ConfigurationManager.AppSettings.Set("umbracoConfigurationStatus", Umbraco.Core.Configuration.GlobalSettings.Version.ToString(3)); ConfigurationManager.AppSettings.Set("umbracoReservedPaths", "~/umbraco,~/install/"); ConfigurationManager.AppSettings.Set("umbracoReservedUrls", "~/config/splashes/booting.aspx,~/install/default.aspx,~/config/splashes/noNodes.aspx,~/VSEnterpriseHelper.axd");