From 4a547ba1c98355b0d0eb9ff184119e499189eefb Mon Sep 17 00:00:00 2001 From: Marc Goodson Date: Wed, 28 Dec 2016 15:11:10 +0000 Subject: [PATCH 01/39] Add some green to 'stay' option - U4-9323 Closes U4-9323 http://issues.umbraco.org/issue/U4-9323 --- .../src/views/common/notifications/confirmroutechange.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/common/notifications/confirmroutechange.html b/src/Umbraco.Web.UI.Client/src/views/common/notifications/confirmroutechange.html index 0b2926307c..a772aa0159 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/notifications/confirmroutechange.html +++ b/src/Umbraco.Web.UI.Client/src/views/common/notifications/confirmroutechange.html @@ -3,5 +3,5 @@

Are you sure you want to navigate away from this page? - you have unsaved changes

- - \ No newline at end of file + + From 0832220d6131625583446f96fe3368fd4ff431ba Mon Sep 17 00:00:00 2001 From: Shannon Date: Fri, 30 Dec 2016 12:07:03 +1100 Subject: [PATCH 02/39] publicizes some APIs needed for Deploy --- src/Umbraco.Core/ObjectExtensions.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Umbraco.Core/ObjectExtensions.cs b/src/Umbraco.Core/ObjectExtensions.cs index 6ed424c232..fcdc2f52a6 100644 --- a/src/Umbraco.Core/ObjectExtensions.cs +++ b/src/Umbraco.Core/ObjectExtensions.cs @@ -468,19 +468,19 @@ namespace Umbraco.Core /// /// /// - internal static IDictionary ToDictionary(this T o, + public static IDictionary ToDictionary(this T o, params Expression>[] ignoreProperties) { return o.ToDictionary(ignoreProperties.Select(e => o.GetPropertyInfo(e)).Select(propInfo => propInfo.Name).ToArray()); } - /// - /// Turns object into dictionary - /// - /// - /// Properties to ignore - /// - internal static IDictionary ToDictionary(this object o, params string[] ignoreProperties) + /// + /// Turns object into dictionary + /// + /// + /// Properties to ignore + /// + public static IDictionary ToDictionary(this object o, params string[] ignoreProperties) { if (o != null) { From ee925692e5734bb29de02bf49195b640a5fd2fba Mon Sep 17 00:00:00 2001 From: Shannon Date: Fri, 30 Dec 2016 16:06:40 +1100 Subject: [PATCH 03/39] Bumps version to put on MyGet --- build/UmbracoVersion.txt | 2 +- src/SolutionInfo.cs | 2 +- src/Umbraco.Core/Configuration/UmbracoVersion.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/UmbracoVersion.txt b/build/UmbracoVersion.txt index a38b20dea5..c017a7b2f8 100644 --- a/build/UmbracoVersion.txt +++ b/build/UmbracoVersion.txt @@ -1,3 +1,3 @@ # Usage: on line 2 put the release version, on line 3 put the version comment (example: beta) 7.6.0 -alpha038 \ No newline at end of file +alpha039 \ No newline at end of file diff --git a/src/SolutionInfo.cs b/src/SolutionInfo.cs index ad8b2bfa02..386986164d 100644 --- a/src/SolutionInfo.cs +++ b/src/SolutionInfo.cs @@ -12,4 +12,4 @@ using System.Resources; [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyFileVersion("7.6.0")] -[assembly: AssemblyInformationalVersion("7.6.0-alpha038")] \ No newline at end of file +[assembly: AssemblyInformationalVersion("7.6.0-alpha039")] \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoVersion.cs b/src/Umbraco.Core/Configuration/UmbracoVersion.cs index d06672172d..8d300790f0 100644 --- a/src/Umbraco.Core/Configuration/UmbracoVersion.cs +++ b/src/Umbraco.Core/Configuration/UmbracoVersion.cs @@ -24,7 +24,7 @@ namespace Umbraco.Core.Configuration /// Gets the version comment (like beta or RC). /// /// The version comment. - public static string CurrentComment { get { return "alpha038"; } } + public static string CurrentComment { get { return "alpha039"; } } // Get the version of the umbraco.dll by looking at a class in that dll // Had to do it like this due to medium trust issues, see: http://haacked.com/archive/2010/11/04/assembly-location-and-medium-trust.aspx From 790e30defd67a8c6cdf3049a1dca282b02f7ea1c Mon Sep 17 00:00:00 2001 From: Shannon Date: Tue, 3 Jan 2017 11:13:38 +1100 Subject: [PATCH 04/39] Simplifies all creation of UrlHelper, creates GetUmbracoApiServiceBaseUrl extensions for WebApi --- src/Umbraco.Web/HttpUrlHelperExtensions.cs | 24 +++++++++++++++++++ .../Models/Mapping/ContentModelMapper.cs | 2 +- .../Models/Mapping/MediaModelMapper.cs | 2 +- .../Models/Mapping/MemberModelMapper.cs | 2 +- src/Umbraco.Web/UI/Controls/UmbracoControl.cs | 2 +- .../UI/Controls/UmbracoUserControl.cs | 2 +- src/Umbraco.Web/UI/Pages/BasePage.cs | 2 +- .../WebServices/UmbracoHttpHandler.cs | 2 +- .../WebServices/UmbracoWebService.cs | 2 +- .../BasePages/BasePage.cs | 2 +- 10 files changed, 33 insertions(+), 9 deletions(-) diff --git a/src/Umbraco.Web/HttpUrlHelperExtensions.cs b/src/Umbraco.Web/HttpUrlHelperExtensions.cs index 1b04a7dd8f..d3e87a6bf7 100644 --- a/src/Umbraco.Web/HttpUrlHelperExtensions.cs +++ b/src/Umbraco.Web/HttpUrlHelperExtensions.cs @@ -122,5 +122,29 @@ namespace Umbraco.Web } } } + + /// + /// Return the Base Url (not including the action) for a Web Api service + /// + /// + /// + /// + /// + public static string GetUmbracoApiServiceBaseUrl(this UrlHelper url, string actionName) + where T : UmbracoApiController + { + return url.GetUmbracoApiService(actionName).TrimEnd(actionName); + } + + public static string GetUmbracoApiServiceBaseUrl(this UrlHelper url, Expression> methodSelector) + where T : UmbracoApiController + { + var method = Core.ExpressionHelper.GetMethodInfo(methodSelector); + if (method == null) + { + throw new MissingMethodException("Could not find the method " + methodSelector + " on type " + typeof(T) + " or the result "); + } + return url.GetUmbracoApiService(method.Name).TrimEnd(method.Name); + } } } \ No newline at end of file diff --git a/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs b/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs index e179159e7c..27f34a12e6 100644 --- a/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs +++ b/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs @@ -115,7 +115,7 @@ namespace Umbraco.Web.Models.Mapping //map the tree node url if (HttpContext.Current != null) { - var urlHelper = new UrlHelper(new RequestContext(new HttpContextWrapper(HttpContext.Current), new RouteData())); + var urlHelper = new UrlHelper(HttpContext.Current.Request.RequestContext); var url = urlHelper.GetUmbracoApiService(controller => controller.GetTreeNode(display.Id.ToString(), null)); display.TreeNodeUrl = url; } diff --git a/src/Umbraco.Web/Models/Mapping/MediaModelMapper.cs b/src/Umbraco.Web/Models/Mapping/MediaModelMapper.cs index c3f9412401..4bcdf7a158 100644 --- a/src/Umbraco.Web/Models/Mapping/MediaModelMapper.cs +++ b/src/Umbraco.Web/Models/Mapping/MediaModelMapper.cs @@ -96,7 +96,7 @@ namespace Umbraco.Web.Models.Mapping //map the tree node url if (HttpContext.Current != null) { - var urlHelper = new UrlHelper(new RequestContext(new HttpContextWrapper(HttpContext.Current), new RouteData())); + var urlHelper = new UrlHelper(HttpContext.Current.Request.RequestContext); var url = urlHelper.GetUmbracoApiService(controller => controller.GetTreeNode(display.Id.ToString(), null)); display.TreeNodeUrl = url; } diff --git a/src/Umbraco.Web/Models/Mapping/MemberModelMapper.cs b/src/Umbraco.Web/Models/Mapping/MemberModelMapper.cs index edb44d36ce..0536efd307 100644 --- a/src/Umbraco.Web/Models/Mapping/MemberModelMapper.cs +++ b/src/Umbraco.Web/Models/Mapping/MemberModelMapper.cs @@ -148,7 +148,7 @@ namespace Umbraco.Web.Models.Mapping //map the tree node url if (HttpContext.Current != null) { - var urlHelper = new UrlHelper(new RequestContext(new HttpContextWrapper(HttpContext.Current), new RouteData())); + var urlHelper = new UrlHelper(HttpContext.Current.Request.RequestContext); var url = urlHelper.GetUmbracoApiService(controller => controller.GetTreeNode(display.Key.ToString("N"), null)); display.TreeNodeUrl = url; } diff --git a/src/Umbraco.Web/UI/Controls/UmbracoControl.cs b/src/Umbraco.Web/UI/Controls/UmbracoControl.cs index bc633b22a3..b84deaa232 100644 --- a/src/Umbraco.Web/UI/Controls/UmbracoControl.cs +++ b/src/Umbraco.Web/UI/Controls/UmbracoControl.cs @@ -81,7 +81,7 @@ namespace Umbraco.Web.UI.Controls /// public UrlHelper Url { - get { return _url ?? (_url = new UrlHelper(new RequestContext(new HttpContextWrapper(Context), new RouteData()))); } + get { return _url ?? (_url = new UrlHelper(Context.Request.RequestContext)); } } /// diff --git a/src/Umbraco.Web/UI/Controls/UmbracoUserControl.cs b/src/Umbraco.Web/UI/Controls/UmbracoUserControl.cs index 2a18413ace..246b9d45c2 100644 --- a/src/Umbraco.Web/UI/Controls/UmbracoUserControl.cs +++ b/src/Umbraco.Web/UI/Controls/UmbracoUserControl.cs @@ -119,7 +119,7 @@ namespace Umbraco.Web.UI.Controls /// public UrlHelper Url { - get { return _url ?? (_url = new UrlHelper(new RequestContext(new HttpContextWrapper(Context), new RouteData()))); } + get { return _url ?? (_url = new UrlHelper(Context.Request.RequestContext)); } } /// diff --git a/src/Umbraco.Web/UI/Pages/BasePage.cs b/src/Umbraco.Web/UI/Pages/BasePage.cs index b9eec4982b..e2c64b7ece 100644 --- a/src/Umbraco.Web/UI/Pages/BasePage.cs +++ b/src/Umbraco.Web/UI/Pages/BasePage.cs @@ -69,7 +69,7 @@ namespace Umbraco.Web.UI.Pages /// public UrlHelper Url { - get { return _url ?? (_url = new UrlHelper(new RequestContext(new HttpContextWrapper(Context), new RouteData()))); } + get { return _url ?? (_url = new UrlHelper(Context.Request.RequestContext)); } } private HtmlHelper _html; diff --git a/src/Umbraco.Web/WebServices/UmbracoHttpHandler.cs b/src/Umbraco.Web/WebServices/UmbracoHttpHandler.cs index d50f28b350..d315f0d20d 100644 --- a/src/Umbraco.Web/WebServices/UmbracoHttpHandler.cs +++ b/src/Umbraco.Web/WebServices/UmbracoHttpHandler.cs @@ -71,7 +71,7 @@ namespace Umbraco.Web.WebServices /// public UrlHelper Url { - get { return _url ?? (_url = new UrlHelper(new RequestContext(new HttpContextWrapper(HttpContext.Current), new RouteData()))); } + get { return _url ?? (_url = new UrlHelper(HttpContext.Current.Request.RequestContext)); } } /// diff --git a/src/Umbraco.Web/WebServices/UmbracoWebService.cs b/src/Umbraco.Web/WebServices/UmbracoWebService.cs index e92e85de1e..55b2d54295 100644 --- a/src/Umbraco.Web/WebServices/UmbracoWebService.cs +++ b/src/Umbraco.Web/WebServices/UmbracoWebService.cs @@ -72,7 +72,7 @@ namespace Umbraco.Web.WebServices /// public UrlHelper Url { - get { return _url ?? (_url = new UrlHelper(new RequestContext(new HttpContextWrapper(Context), new RouteData()))); } + get { return _url ?? (_url = new UrlHelper(Context.Request.RequestContext)); } } /// diff --git a/src/umbraco.businesslogic/BasePages/BasePage.cs b/src/umbraco.businesslogic/BasePages/BasePage.cs index 6af70e21a9..b1f58d0745 100644 --- a/src/umbraco.businesslogic/BasePages/BasePage.cs +++ b/src/umbraco.businesslogic/BasePages/BasePage.cs @@ -113,7 +113,7 @@ namespace umbraco.BasePages /// public UrlHelper Url { - get { return _url ?? (_url = new UrlHelper(new RequestContext(new HttpContextWrapper(Context), new RouteData()))); } + get { return _url ?? (_url = new UrlHelper(Context.Request.RequestContext)); } } /// From 95187becaff00aab5a218c4c7b6004518f810d0c Mon Sep 17 00:00:00 2001 From: Shannon Date: Tue, 3 Jan 2017 11:50:29 +1100 Subject: [PATCH 05/39] bumps to next alpha for MyGet --- build/UmbracoVersion.txt | 2 +- src/SolutionInfo.cs | 4 ++-- src/Umbraco.Core/Configuration/UmbracoVersion.cs | 2 +- src/Umbraco.Web/Security/Identity/AppBuilderExtensions.cs | 4 +++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/build/UmbracoVersion.txt b/build/UmbracoVersion.txt index c017a7b2f8..665efe4889 100644 --- a/build/UmbracoVersion.txt +++ b/build/UmbracoVersion.txt @@ -1,3 +1,3 @@ # Usage: on line 2 put the release version, on line 3 put the version comment (example: beta) 7.6.0 -alpha039 \ No newline at end of file +alpha042 \ No newline at end of file diff --git a/src/SolutionInfo.cs b/src/SolutionInfo.cs index 386986164d..bcb15d3bd0 100644 --- a/src/SolutionInfo.cs +++ b/src/SolutionInfo.cs @@ -2,7 +2,7 @@ using System.Resources; [assembly: AssemblyCompany("Umbraco")] -[assembly: AssemblyCopyright("Copyright © Umbraco 2016")] +[assembly: AssemblyCopyright("Copyright © Umbraco 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -12,4 +12,4 @@ using System.Resources; [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyFileVersion("7.6.0")] -[assembly: AssemblyInformationalVersion("7.6.0-alpha039")] \ No newline at end of file +[assembly: AssemblyInformationalVersion("7.6.0-alpha042")] \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoVersion.cs b/src/Umbraco.Core/Configuration/UmbracoVersion.cs index 8d300790f0..c2b58d93f1 100644 --- a/src/Umbraco.Core/Configuration/UmbracoVersion.cs +++ b/src/Umbraco.Core/Configuration/UmbracoVersion.cs @@ -24,7 +24,7 @@ namespace Umbraco.Core.Configuration /// Gets the version comment (like beta or RC). /// /// The version comment. - public static string CurrentComment { get { return "alpha039"; } } + public static string CurrentComment { get { return "alpha042"; } } // Get the version of the umbraco.dll by looking at a class in that dll // Had to do it like this due to medium trust issues, see: http://haacked.com/archive/2010/11/04/assembly-location-and-medium-trust.aspx diff --git a/src/Umbraco.Web/Security/Identity/AppBuilderExtensions.cs b/src/Umbraco.Web/Security/Identity/AppBuilderExtensions.cs index 80903dff90..010e2a8889 100644 --- a/src/Umbraco.Web/Security/Identity/AppBuilderExtensions.cs +++ b/src/Umbraco.Web/Security/Identity/AppBuilderExtensions.cs @@ -58,7 +58,9 @@ namespace Umbraco.Web.Security.Identity // TODO: Move this method in v8, it doesn't belong in this namespace/extension class public static void ConfigureSignalR(this IAppBuilder app) { - app.MapSignalR("/umbraco/signalr", new HubConfiguration { EnableDetailedErrors = true }); + var umbracoPath = GlobalSettings.UmbracoMvcArea.EnsureStartsWith('/'); + + app.MapSignalR(umbracoPath + "/BackOffice/signalr", new HubConfiguration { EnableDetailedErrors = true }); } /// From 6b038186be6a39e4fe39f2230c80125c8ffddbeb Mon Sep 17 00:00:00 2001 From: Shannon Date: Tue, 3 Jan 2017 13:11:05 +1100 Subject: [PATCH 06/39] Fixes SignalR registration, the mapping was registered in the wrong place and too early so security was not working, bumps version for MyGet --- build/UmbracoVersion.txt | 2 +- src/SolutionInfo.cs | 2 +- src/Umbraco.Core/Configuration/UmbracoVersion.cs | 2 +- .../Security/Identity/AppBuilderExtensions.cs | 15 +++++++++++---- src/Umbraco.Web/UmbracoDefaultOwinStartup.cs | 5 ++--- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/build/UmbracoVersion.txt b/build/UmbracoVersion.txt index 665efe4889..4dad972e68 100644 --- a/build/UmbracoVersion.txt +++ b/build/UmbracoVersion.txt @@ -1,3 +1,3 @@ # Usage: on line 2 put the release version, on line 3 put the version comment (example: beta) 7.6.0 -alpha042 \ No newline at end of file +alpha043 \ No newline at end of file diff --git a/src/SolutionInfo.cs b/src/SolutionInfo.cs index bcb15d3bd0..8eb9558419 100644 --- a/src/SolutionInfo.cs +++ b/src/SolutionInfo.cs @@ -12,4 +12,4 @@ using System.Resources; [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyFileVersion("7.6.0")] -[assembly: AssemblyInformationalVersion("7.6.0-alpha042")] \ No newline at end of file +[assembly: AssemblyInformationalVersion("7.6.0-alpha043")] \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoVersion.cs b/src/Umbraco.Core/Configuration/UmbracoVersion.cs index c2b58d93f1..79e4260028 100644 --- a/src/Umbraco.Core/Configuration/UmbracoVersion.cs +++ b/src/Umbraco.Core/Configuration/UmbracoVersion.cs @@ -24,7 +24,7 @@ namespace Umbraco.Core.Configuration /// Gets the version comment (like beta or RC). /// /// The version comment. - public static string CurrentComment { get { return "alpha042"; } } + public static string CurrentComment { get { return "alpha043"; } } // Get the version of the umbraco.dll by looking at a class in that dll // Had to do it like this due to medium trust issues, see: http://haacked.com/archive/2010/11/04/assembly-location-and-medium-trust.aspx diff --git a/src/Umbraco.Web/Security/Identity/AppBuilderExtensions.cs b/src/Umbraco.Web/Security/Identity/AppBuilderExtensions.cs index 010e2a8889..7e4c9c45aa 100644 --- a/src/Umbraco.Web/Security/Identity/AppBuilderExtensions.cs +++ b/src/Umbraco.Web/Security/Identity/AppBuilderExtensions.cs @@ -55,12 +55,19 @@ namespace Umbraco.Web.Security.Identity app.SetLoggerFactory(new OwinLoggerFactory()); } - // TODO: Move this method in v8, it doesn't belong in this namespace/extension class - public static void ConfigureSignalR(this IAppBuilder app) + /// + /// This maps a Signal path/hub + /// + /// + /// + public static IAppBuilder UseSignalR(this IAppBuilder app) { - var umbracoPath = GlobalSettings.UmbracoMvcArea.EnsureStartsWith('/'); + + // TODO: Move this method in v8, it doesn't belong in this namespace/extension class + var umbracoPath = GlobalSettings.UmbracoMvcArea; - app.MapSignalR(umbracoPath + "/BackOffice/signalr", new HubConfiguration { EnableDetailedErrors = true }); + return app.MapSignalR(HttpRuntime.AppDomainAppVirtualPath + + umbracoPath + "/BackOffice/signalr", new HubConfiguration { EnableDetailedErrors = true }); } /// diff --git a/src/Umbraco.Web/UmbracoDefaultOwinStartup.cs b/src/Umbraco.Web/UmbracoDefaultOwinStartup.cs index 01745ef8f0..c11252d2ca 100644 --- a/src/Umbraco.Web/UmbracoDefaultOwinStartup.cs +++ b/src/Umbraco.Web/UmbracoDefaultOwinStartup.cs @@ -42,9 +42,7 @@ namespace Umbraco.Web // (EXPERT: an overload accepts a custom BackOfficeUserStore implementation) app.ConfigureUserManagerForUmbracoBackOffice( ApplicationContext, - Core.Security.MembershipProviderExtensions.GetUsersMembershipProvider().AsUmbracoMembershipProvider()); - - app.ConfigureSignalR(); + Core.Security.MembershipProviderExtensions.GetUsersMembershipProvider().AsUmbracoMembershipProvider()); } /// @@ -59,6 +57,7 @@ namespace Umbraco.Web .UseUmbracoBackOfficeCookieAuthentication(ApplicationContext, PipelineStage.Authenticate) .UseUmbracoBackOfficeExternalCookieAuthentication(ApplicationContext, PipelineStage.Authenticate) .UseUmbracoPreviewAuthentication(ApplicationContext, PipelineStage.Authorize) + .UseSignalR() .FinalizeMiddlewareConfiguration(); } From d8b70d79e8f047e8e14426d0e7020b5b1173dfad Mon Sep 17 00:00:00 2001 From: Stephan Date: Tue, 3 Jan 2017 09:29:22 +0100 Subject: [PATCH 07/39] Version 7.6.0-alpha044 on MyGet --- build/UmbracoVersion.txt | 4 ++-- src/SolutionInfo.cs | 2 +- src/Umbraco.Core/Configuration/UmbracoVersion.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/UmbracoVersion.txt b/build/UmbracoVersion.txt index 4dad972e68..096e4d6b5c 100644 --- a/build/UmbracoVersion.txt +++ b/build/UmbracoVersion.txt @@ -1,3 +1,3 @@ -# Usage: on line 2 put the release version, on line 3 put the version comment (example: beta) +# Usage: on line 2 put the release version, on line 3 put the version comment (example: beta) 7.6.0 -alpha043 \ No newline at end of file +alpha044 diff --git a/src/SolutionInfo.cs b/src/SolutionInfo.cs index 8eb9558419..5e904fab70 100644 --- a/src/SolutionInfo.cs +++ b/src/SolutionInfo.cs @@ -12,4 +12,4 @@ using System.Resources; [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyFileVersion("7.6.0")] -[assembly: AssemblyInformationalVersion("7.6.0-alpha043")] \ No newline at end of file +[assembly: AssemblyInformationalVersion("7.6.0-alpha044")] \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoVersion.cs b/src/Umbraco.Core/Configuration/UmbracoVersion.cs index 79e4260028..03b1827221 100644 --- a/src/Umbraco.Core/Configuration/UmbracoVersion.cs +++ b/src/Umbraco.Core/Configuration/UmbracoVersion.cs @@ -24,7 +24,7 @@ namespace Umbraco.Core.Configuration /// Gets the version comment (like beta or RC). /// /// The version comment. - public static string CurrentComment { get { return "alpha043"; } } + public static string CurrentComment { get { return "alpha044"; } } // Get the version of the umbraco.dll by looking at a class in that dll // Had to do it like this due to medium trust issues, see: http://haacked.com/archive/2010/11/04/assembly-location-and-medium-trust.aspx From 2acde54880e62a3e3c1b16587d511936acefc68b Mon Sep 17 00:00:00 2001 From: Shannon Date: Wed, 4 Jan 2017 18:11:21 +1100 Subject: [PATCH 08/39] Adds new benchmark and updates the benchmark bootstrapper to be the supported way --- .../LinqCastBenchmarks.cs | 58 +++++++++++++++++++ src/Umbraco.Tests.Benchmarks/Program.cs | 23 +++----- .../Umbraco.Tests.Benchmarks.csproj | 1 + 3 files changed, 66 insertions(+), 16 deletions(-) create mode 100644 src/Umbraco.Tests.Benchmarks/LinqCastBenchmarks.cs diff --git a/src/Umbraco.Tests.Benchmarks/LinqCastBenchmarks.cs b/src/Umbraco.Tests.Benchmarks/LinqCastBenchmarks.cs new file mode 100644 index 0000000000..4118620515 --- /dev/null +++ b/src/Umbraco.Tests.Benchmarks/LinqCastBenchmarks.cs @@ -0,0 +1,58 @@ +using System.Collections.Generic; +using System.Linq; +using BenchmarkDotNet.Attributes; +using BenchmarkDotNet.Configs; +using BenchmarkDotNet.Diagnostics.Windows; + +namespace Umbraco.Tests.Benchmarks +{ + /// + /// Want to check what is faster OfType or Cast when a enurable all has the same items + /// + [Config(typeof(Config))] + public class LinqCastBenchmarks + { + private class Config : ManualConfig + { + public Config() + { + Add(new MemoryDiagnoser()); + } + } + + public LinqCastBenchmarks() + { + _array = new List(); + _array.AddRange(Enumerable.Range(0, 10000).Select(x => x.ToString())); + } + + private readonly List _array; + + [Benchmark(Baseline = true)] + public void OfType() + { + foreach (var i in _array.OfType()) + { + var a = i; + } + } + + [Benchmark()] + public void Cast() + { + foreach (var i in _array.Cast()) + { + var a = i; + } + } + + [Benchmark()] + public void ExplicitCast() + { + foreach (var i in _array) + { + var a = (string)i; + } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests.Benchmarks/Program.cs b/src/Umbraco.Tests.Benchmarks/Program.cs index 52736ed6a4..eb49f153cc 100644 --- a/src/Umbraco.Tests.Benchmarks/Program.cs +++ b/src/Umbraco.Tests.Benchmarks/Program.cs @@ -8,23 +8,14 @@ namespace Umbraco.Tests.Benchmarks { public static void Main(string[] args) { - if (args.Length == 1) + var switcher = new BenchmarkSwitcher(new[] { - var type = Assembly.GetExecutingAssembly().GetType("Umbraco.Tests.Benchmarks." +args[0]); - if (type == null) - { - Console.WriteLine("Unknown benchmark."); - } - else - { - var summary = BenchmarkRunner.Run(type); - Console.ReadLine(); - } - } - else - { - Console.WriteLine("?"); - } + typeof(BulkInsertBenchmarks), + typeof(ModelToSqlExpressionHelperBenchmarks), + typeof(XmlBenchmarks), + typeof(LinqCastBenchmarks) + }); + switcher.Run(args); } } } diff --git a/src/Umbraco.Tests.Benchmarks/Umbraco.Tests.Benchmarks.csproj b/src/Umbraco.Tests.Benchmarks/Umbraco.Tests.Benchmarks.csproj index 9f6d4e799f..39d77bbc26 100644 --- a/src/Umbraco.Tests.Benchmarks/Umbraco.Tests.Benchmarks.csproj +++ b/src/Umbraco.Tests.Benchmarks/Umbraco.Tests.Benchmarks.csproj @@ -85,6 +85,7 @@ + From 256ceef875f4c4c7c190b40c2d3025bcdbde49c6 Mon Sep 17 00:00:00 2001 From: Shannon Date: Wed, 4 Jan 2017 18:12:28 +1100 Subject: [PATCH 09/39] changes PublishedContentCache to explicitly cast to XmlElement (perf) --- .../XmlPublishedCache/PublishedContentCache.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs index e58bc73b25..5033948730 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs @@ -179,8 +179,11 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache elt = null; var min = int.MaxValue; - foreach (var e in xml.DocumentElement.ChildNodes.OfType()) + //Don't use OfType or Cast, this is critical code, all ChildNodes are XmlElement so explicitly cast + // https://gist.github.com/Shazwazza/04e2e5642a316f4a87e52dada2901198 + foreach (var n in xml.DocumentElement.ChildNodes) { + var e = (XmlElement) n; var sortOrder = int.Parse(e.GetAttribute("sortOrder")); if (sortOrder < min) { @@ -201,8 +204,11 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache if (hideTopLevelNode && startNodeId <= 0) { - foreach (var e in elt.ChildNodes.OfType()) + //Don't use OfType or Cast, this is critical code, all ChildNodes are XmlElement so explicitly cast + // https://gist.github.com/Shazwazza/04e2e5642a316f4a87e52dada2901198 + foreach (var n in elt.ChildNodes) { + var e = (XmlElement)n; var id = NavigateElementRoute(e, urlParts); if (id > 0) return id; } @@ -224,8 +230,11 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache while (found && i < urlParts.Length) { found = false; - foreach (var child in elt.ChildNodes.OfType()) + //Don't use OfType or Cast, this is critical code, all ChildNodes are XmlElement so explicitly cast + // https://gist.github.com/Shazwazza/04e2e5642a316f4a87e52dada2901198 + foreach (var o in elt.ChildNodes) { + var child = (XmlElement) o; var noNode = UseLegacySchema ? child.Name != "node" : child.GetAttributeNode("isDoc") == null; From 4ab2130d7dead45aadc07d7d745541ecf116867d Mon Sep 17 00:00:00 2001 From: Shannon Date: Wed, 4 Jan 2017 18:40:00 +1100 Subject: [PATCH 10/39] stop allocating and re-processing config elements every time they are accessed! --- .../UmbracoSettings/ContentElement.cs | 179 +++--------------- .../UmbracoConfigurationElement.cs | 36 ++++ 2 files changed, 59 insertions(+), 156 deletions(-) create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/UmbracoConfigurationElement.cs diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs index d743daca6a..aed7f61a06 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs @@ -4,8 +4,7 @@ using System.Configuration; namespace Umbraco.Core.Configuration.UmbracoSettings { - - internal class ContentElement : ConfigurationElement, IContentSection + internal class ContentElement : UmbracoConfigurationElement, IContentSection { [ConfigurationProperty("imaging")] internal ContentImagingElement Imaging @@ -22,25 +21,13 @@ namespace Umbraco.Core.Configuration.UmbracoSettings [ConfigurationProperty("ResolveUrlsFromTextString")] internal InnerTextConfigurationElement ResolveUrlsFromTextString { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["ResolveUrlsFromTextString"], - //set the default - false); - } + get { return GetOptionalTextElement("ResolveUrlsFromTextString", false); } } [ConfigurationProperty("UploadAllowDirectories")] internal InnerTextConfigurationElement UploadAllowDirectories { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["UploadAllowDirectories"], - //set the default - true); - } + get { return GetOptionalTextElement("UploadAllowDirectories", true); } } public IEnumerable Error404Collection @@ -63,121 +50,61 @@ namespace Umbraco.Core.Configuration.UmbracoSettings [ConfigurationProperty("ensureUniqueNaming")] internal InnerTextConfigurationElement EnsureUniqueNaming { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["ensureUniqueNaming"], - //set the default - true); - } + get { return GetOptionalTextElement("ensureUniqueNaming", true); } } [ConfigurationProperty("TidyEditorContent")] internal InnerTextConfigurationElement TidyEditorContent { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["TidyEditorContent"], - //set the default - false); - } + get { return GetOptionalTextElement("TidyEditorContent", false); } } [ConfigurationProperty("TidyCharEncoding")] internal InnerTextConfigurationElement TidyCharEncoding { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["TidyCharEncoding"], - //set the default - "UTF8"); - } + get { return GetOptionalTextElement("TidyCharEncoding", "UTF8"); } } [ConfigurationProperty("XmlCacheEnabled")] internal InnerTextConfigurationElement XmlCacheEnabled { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["XmlCacheEnabled"], - //set the default - true); - } + get { return GetOptionalTextElement("XmlCacheEnabled", true); } } [ConfigurationProperty("ContinouslyUpdateXmlDiskCache")] internal InnerTextConfigurationElement ContinouslyUpdateXmlDiskCache { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["ContinouslyUpdateXmlDiskCache"], - //set the default - true); - } + get { return GetOptionalTextElement("ContinouslyUpdateXmlDiskCache", true); } } [ConfigurationProperty("XmlContentCheckForDiskChanges")] internal InnerTextConfigurationElement XmlContentCheckForDiskChanges { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["XmlContentCheckForDiskChanges"], - //set the default - false); - } + get { return GetOptionalTextElement("XmlContentCheckForDiskChanges", false); } } [ConfigurationProperty("EnableSplashWhileLoading")] internal InnerTextConfigurationElement EnableSplashWhileLoading { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["EnableSplashWhileLoading"], - //set the default - false); - } + get { return GetOptionalTextElement("EnableSplashWhileLoading", false); } } [ConfigurationProperty("PropertyContextHelpOption")] internal InnerTextConfigurationElement PropertyContextHelpOption { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["PropertyContextHelpOption"], - //set the default - "text"); - } + get { return GetOptionalTextElement("PropertyContextHelpOption", "text"); } } [ConfigurationProperty("UseLegacyXmlSchema")] internal InnerTextConfigurationElement UseLegacyXmlSchema { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["UseLegacyXmlSchema"], - //set the default - false); - } + get { return GetOptionalTextElement("UseLegacyXmlSchema", false); } } [ConfigurationProperty("ForceSafeAliases")] internal InnerTextConfigurationElement ForceSafeAliases { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["ForceSafeAliases"], - //set the default - true); - } + get { return GetOptionalTextElement("ForceSafeAliases", true); } } [ConfigurationProperty("PreviewBadge")] @@ -185,123 +112,63 @@ namespace Umbraco.Core.Configuration.UmbracoSettings { get { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["PreviewBadge"], - //set the default - @"In Preview Mode - click to end"); + return GetOptionalTextElement("PreviewBadge", @"In Preview Mode - click to end"); } } [ConfigurationProperty("UmbracoLibraryCacheDuration")] internal InnerTextConfigurationElement UmbracoLibraryCacheDuration { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["UmbracoLibraryCacheDuration"], - //set the default - 1800); - - } + get { return GetOptionalTextElement("UmbracoLibraryCacheDuration", 1800); } } [ConfigurationProperty("MacroErrors")] internal InnerTextConfigurationElement MacroErrors { - get - { - - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["MacroErrors"], - //set the default - MacroErrorBehaviour.Inline); - } + get { return GetOptionalTextElement("MacroErrors", MacroErrorBehaviour.Inline); } } [Obsolete("This is here so that if this config element exists we won't get a YSOD, it is not used whatsoever and will be removed in future versions")] [ConfigurationProperty("DocumentTypeIconList")] internal InnerTextConfigurationElement DocumentTypeIconList { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["DocumentTypeIconList"], - //set the default - IconPickerBehaviour.HideFileDuplicates); - } + get { return GetOptionalTextElement("DocumentTypeIconList", IconPickerBehaviour.HideFileDuplicates); } } [ConfigurationProperty("disallowedUploadFiles")] internal CommaDelimitedConfigurationElement DisallowedUploadFiles { - get - { - return new OptionalCommaDelimitedConfigurationElement( - (CommaDelimitedConfigurationElement)this["disallowedUploadFiles"], - //set the default - new[] { "ashx", "aspx", "ascx", "config", "cshtml", "vbhtml", "asmx", "air", "axd" }); - - } + get { return GetOptionalDelimitedElement("disallowedUploadFiles", new[] {"ashx", "aspx", "ascx", "config", "cshtml", "vbhtml", "asmx", "air", "axd"}); } } [ConfigurationProperty("cloneXmlContent")] internal InnerTextConfigurationElement CloneXmlContent { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["cloneXmlContent"], - //set the default - true); - } + get { return GetOptionalTextElement("cloneXmlContent", true); } } [ConfigurationProperty("GlobalPreviewStorageEnabled")] internal InnerTextConfigurationElement GlobalPreviewStorageEnabled { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["GlobalPreviewStorageEnabled"], - //set the default - false); - } + get { return GetOptionalTextElement("GlobalPreviewStorageEnabled", false); } } [ConfigurationProperty("defaultDocumentTypeProperty")] internal InnerTextConfigurationElement DefaultDocumentTypeProperty { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["defaultDocumentTypeProperty"], - //set the default - "Textstring"); - } + get { return GetOptionalTextElement("defaultDocumentTypeProperty", "Textstring"); } } [ConfigurationProperty("EnableInheritedDocumentTypes")] internal InnerTextConfigurationElement EnableInheritedDocumentTypes { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement) this["EnableInheritedDocumentTypes"], - //set the default - true); - } + get { return GetOptionalTextElement("EnableInheritedDocumentTypes", true); } } [ConfigurationProperty("EnableInheritedMediaTypes")] internal InnerTextConfigurationElement EnableInheritedMediaTypes { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["EnableInheritedMediaTypes"], - //set the default - true); - } + get { return GetOptionalTextElement("EnableInheritedMediaTypes", true); } } string IContentSection.NotificationEmailAddress diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/UmbracoConfigurationElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/UmbracoConfigurationElement.cs new file mode 100644 index 0000000000..063b5324d8 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/UmbracoConfigurationElement.cs @@ -0,0 +1,36 @@ +using System.Collections.Concurrent; +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + /// + /// Base class with shared helper methods + /// + internal class UmbracoConfigurationElement : ConfigurationElement + { + /// + /// Used so the RawElement types are not re-created every time they are accessed + /// + private readonly ConcurrentDictionary _rawElements = new ConcurrentDictionary(); + + protected OptionalInnerTextConfigurationElement GetOptionalTextElement(string name, T defaultVal) + { + return (OptionalInnerTextConfigurationElement) _rawElements.GetOrAdd( + name, + s => new OptionalInnerTextConfigurationElement( + (InnerTextConfigurationElement) this[s], + //set the default + defaultVal)); + } + + protected OptionalCommaDelimitedConfigurationElement GetOptionalDelimitedElement(string name, string[] defaultVal) + { + return (OptionalCommaDelimitedConfigurationElement) _rawElements.GetOrAdd( + name, + s => new OptionalCommaDelimitedConfigurationElement( + (CommaDelimitedConfigurationElement) this[name], + //set the default + defaultVal)); + } + } +} \ No newline at end of file From 466a37aab8832158fe4e968c49f592408428a33d Mon Sep 17 00:00:00 2001 From: Shannon Date: Wed, 4 Jan 2017 18:42:11 +1100 Subject: [PATCH 11/39] fix build --- src/Umbraco.Core/Umbraco.Core.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index d23c71a247..56958ac0e6 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -281,6 +281,7 @@ + From 13ed3303f50c8ff9f226ace28823bec882b16b95 Mon Sep 17 00:00:00 2001 From: Stephan Date: Wed, 4 Jan 2017 12:56:32 +0100 Subject: [PATCH 12/39] U4-9337 - url routing perfs --- src/Umbraco.Web/Models/ContentExtensions.cs | 6 +- .../PublishedContentCache.cs | 139 +++++++----------- src/Umbraco.Web/Routing/DefaultUrlProvider.cs | 11 -- .../Routing/PublishedContentRequestEngine.cs | 26 ++++ .../Routing/RedirectTrackingEventHandler.cs | 3 +- .../Routing/UrlProviderExtensions.cs | 58 +++++--- 6 files changed, 116 insertions(+), 127 deletions(-) diff --git a/src/Umbraco.Web/Models/ContentExtensions.cs b/src/Umbraco.Web/Models/ContentExtensions.cs index cfee14a2a8..d1f153125e 100644 --- a/src/Umbraco.Web/Models/ContentExtensions.cs +++ b/src/Umbraco.Web/Models/ContentExtensions.cs @@ -46,9 +46,7 @@ namespace Umbraco.Web.Models { var route = umbracoContext == null ? null // for tests only - : umbracoContext.ContentCache.GetRouteById(contentId); // cached - - if (route != null && route.StartsWith("err/")) route = null; + : umbracoContext.ContentCache.GetRouteById(contentId); // may be cached var domainHelper = new DomainHelper(domainService); IDomain domain; @@ -73,7 +71,7 @@ namespace Umbraco.Web.Models } else { - // if content is published then we have a (cached) route + // if content is published then we have a route // from which we can figure out the domain var pos = route.IndexOf('/'); diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs index 5033948730..0b027deb92 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs @@ -98,42 +98,10 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache // else actually determine the route route = DetermineRouteById(umbracoContext, preview, contentId); - // node not found - if (route == null) - return null; - - // find the content back, detect routes collisions: we should find ourselves back, - // else it means that another content with "higher priority" is sharing the same route. - // perf impact: - // - non-colliding, adds one complete "by route" lookup, only on the first time a url is computed (then it's cached anyways) - // - colliding, adds one "by route" lookup, the first time the url is computed, then one dictionary looked each time it is computed again - // assuming no collisions, the impact is one complete "by route" lookup the first time each url is computed - // - // U4-9121 - this lookup is too expensive when computing a large amount of urls on a front-end (eg menu) - // ... thinking about moving the lookup out of the path into its own async task, so we are not reporting errors - // in the back-office anymore, but at least we are not polluting the cache - // instead, refactored DeterminedIdByRoute to stop using XPath, with a 16x improvement according to benchmarks - // will it be enough? - - var loopId = preview ? 0 : _routesCache.GetNodeId(route); // might be cached already in case of collision - if (loopId == 0) - { - var content = DetermineIdByRoute(umbracoContext, preview, route, GlobalSettings.HideTopLevelNodeFromPath); - - // add the other route to cache so next time we have it already - if (content != null && preview == false) - AddToCacheIfDeepestRoute(umbracoContext, content, route); - - loopId = content == null ? 0 : content.Id; // though... 0 here would be quite weird? - } - - // cache if we have a route and not previewing and it's not a colliding route - // (the result of DetermineRouteById is always the deepest route) - if (/*route != null &&*/ preview == false && loopId == contentId) - _routesCache.Store(contentId, route); - - // return route if no collision, else report collision - return loopId == contentId ? route : ("err/" + loopId); + // may be null if node not found + // do NOT cache the route: it may be colliding - and since checking for a collision implies + // doing one DetermineIdByRoute anyways we are not causing any perf penalty by not caching + return route; } IPublishedContent DetermineIdByRoute(UmbracoContext umbracoContext, bool preview, string route, bool hideTopLevelNode) @@ -149,18 +117,25 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache //check if we can find the node in our xml cache var id = NavigateRoute(umbracoContext, preview, startNodeId, path, hideTopLevelNode); - if (id > 0) return GetById(umbracoContext, preview, id); + return id > 0 ? GetById(umbracoContext, preview, id) : null; + } - // if hideTopLevelNodePath is true then for url /foo we looked for /*/foo - // but maybe that was the url of a non-default top-level node, so we also - // have to look for /foo (see note in ApplyHideTopLevelNodeFromPath). - if (hideTopLevelNode && path.Length > 1 && path.IndexOf('/', 1) < 0) + private static XmlElement GetXmlElementChildWithLowestSortOrder(XmlNode element) + { + XmlElement elt = null; + var min = int.MaxValue; + foreach (var n in element.ChildNodes) { - var id2 = NavigateRoute(umbracoContext, preview, startNodeId, path, false); - if (id2 > 0) return GetById(umbracoContext, preview, id2); - } + var e = n as XmlElement; + if (e == null) continue; - return null; + var sortOrder = int.Parse(e.GetAttribute("sortOrder")); + if (sortOrder >= min) continue; + + min = sortOrder; + elt = e; + } + return elt; } private int NavigateRoute(UmbracoContext umbracoContext, bool preview, int startNodeId, string path, bool hideTopLevelNode) @@ -177,20 +152,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache return elt == null ? -1 : startNodeId; } - elt = null; - var min = int.MaxValue; - //Don't use OfType or Cast, this is critical code, all ChildNodes are XmlElement so explicitly cast - // https://gist.github.com/Shazwazza/04e2e5642a316f4a87e52dada2901198 - foreach (var n in xml.DocumentElement.ChildNodes) - { - var e = (XmlElement) n; - var sortOrder = int.Parse(e.GetAttribute("sortOrder")); - if (sortOrder < min) - { - min = sortOrder; - elt = e; - } - } + elt = GetXmlElementChildWithLowestSortOrder(xml.DocumentElement); return elt == null ? -1 : int.Parse(elt.GetAttribute("id")); } @@ -208,10 +170,16 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache // https://gist.github.com/Shazwazza/04e2e5642a316f4a87e52dada2901198 foreach (var n in elt.ChildNodes) { - var e = (XmlElement)n; + var e = n as XmlElement; + if (e == null) continue; + var id = NavigateElementRoute(e, urlParts); if (id > 0) return id; } + + if (urlParts.Length == 1) + return NavigateElementRoute(elt, urlParts); + return -1; } @@ -232,9 +200,12 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache found = false; //Don't use OfType or Cast, this is critical code, all ChildNodes are XmlElement so explicitly cast // https://gist.github.com/Shazwazza/04e2e5642a316f4a87e52dada2901198 + var sortOrder = -1; foreach (var o in elt.ChildNodes) { - var child = (XmlElement) o; + var child = o as XmlElement; + if (child == null) continue; + var noNode = UseLegacySchema ? child.Name != "node" : child.GetAttributeNode("isDoc") == null; @@ -242,8 +213,12 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache if (child.GetAttribute("urlName") != urlParts[i]) continue; found = true; + + var so = int.Parse(child.GetAttribute("sortOrder")); + if (sortOrder >= 0 && so >= sortOrder) continue; + + sortOrder = so; elt = child; - break; } i++; } @@ -252,7 +227,8 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache string DetermineRouteById(UmbracoContext umbracoContext, bool preview, int contentId) { - var elt = GetXml(umbracoContext, preview).GetElementById(contentId.ToString(CultureInfo.InvariantCulture)); + var xml = GetXml(umbracoContext, preview); + var elt = xml.GetElementById(contentId.ToString(CultureInfo.InvariantCulture)); if (elt == null) return null; var domainHelper = GetDomainHelper(umbracoContext.Application.Services.DomainService); @@ -279,7 +255,18 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache // no domain, respect HideTopLevelNodeFromPath for legacy purposes if (hasDomains == false && GlobalSettings.HideTopLevelNodeFromPath) - ApplyHideTopLevelNodeFromPath(umbracoContext, eltId, eltParentId, pathParts); + { + if (eltParentId == -1) + { + var rootNode = GetXmlElementChildWithLowestSortOrder(xml.DocumentElement); + if (rootNode != null && rootNode == elt) + pathParts.RemoveAt(pathParts.Count - 1); + } + else + { + pathParts.RemoveAt(pathParts.Count - 1); + } + } // assemble the route pathParts.Reverse(); @@ -289,30 +276,6 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache return route; } - static void ApplyHideTopLevelNodeFromPath(UmbracoContext umbracoContext, int nodeId, int parentId, IList pathParts) - { - // in theory if hideTopLevelNodeFromPath is true, then there should be only once - // top-level node, or else domains should be assigned. but for backward compatibility - // we add this check - we look for the document matching "/" and if it's not us, then - // we do not hide the top level path - // it has to be taken care of in GetByRoute too so if - // "/foo" fails (looking for "/*/foo") we try also "/foo". - // this does not make much sense anyway esp. if both "/foo/" and "/bar/foo" exist, but - // that's the way it works pre-4.10 and we try to be backward compat for the time being - if (parentId == -1) - { - var rootNode = umbracoContext.ContentCache.GetByRoute("/", true); - if (rootNode == null) - throw new Exception("Failed to get node at /."); - if (rootNode.Id == nodeId) // remove only if we're the default node - pathParts.RemoveAt(pathParts.Count - 1); - } - else - { - pathParts.RemoveAt(pathParts.Count - 1); - } - } - #endregion #region XPath Strings diff --git a/src/Umbraco.Web/Routing/DefaultUrlProvider.cs b/src/Umbraco.Web/Routing/DefaultUrlProvider.cs index d55095d151..6b3c0fe69b 100644 --- a/src/Umbraco.Web/Routing/DefaultUrlProvider.cs +++ b/src/Umbraco.Web/Routing/DefaultUrlProvider.cs @@ -65,14 +65,6 @@ namespace Umbraco.Web.Routing return null; } - if (route.StartsWith("err/")) - { - LogHelper.Debug( - "Page with nodeId={0} has a colliding url with page with nodeId={1}.", - () => id, () => route.Substring(4)); - return "#err-" + route.Substring(4); - } - var domainHelper = new DomainHelper(umbracoContext.Application.Services.DomainService); // extract domainUri and path @@ -115,9 +107,6 @@ namespace Umbraco.Web.Routing return null; } - if (route.StartsWith("err/")) - return null; - var domainHelper = new DomainHelper(umbracoContext.Application.Services.DomainService); // extract domainUri and path diff --git a/src/Umbraco.Web/Routing/PublishedContentRequestEngine.cs b/src/Umbraco.Web/Routing/PublishedContentRequestEngine.cs index 03a50a4b99..05b6b0e468 100644 --- a/src/Umbraco.Web/Routing/PublishedContentRequestEngine.cs +++ b/src/Umbraco.Web/Routing/PublishedContentRequestEngine.cs @@ -67,6 +67,32 @@ namespace Umbraco.Web.Routing #region Public + /// + /// Tries to route the request. + /// + internal bool TryRouteRequest() + { + // disabled - is it going to change the routing? + //_pcr.OnPreparing(); + + FindDomain(); + if (_pcr.IsRedirect) return false; + if (_pcr.HasPublishedContent) return true; + FindPublishedContent(); + if (_pcr.IsRedirect) return false; + + // don't handle anything - we just want to ensure that we find the content + //HandlePublishedContent(); + //FindTemplate(); + //FollowExternalRedirect(); + //HandleWildcardDomains(); + + // disabled - we just want to ensure that we find the content + //_pcr.OnPrepared(); + + return _pcr.HasPublishedContent; + } + /// /// Prepares the request. /// diff --git a/src/Umbraco.Web/Routing/RedirectTrackingEventHandler.cs b/src/Umbraco.Web/Routing/RedirectTrackingEventHandler.cs index b13cb7b296..80e4192f72 100644 --- a/src/Umbraco.Web/Routing/RedirectTrackingEventHandler.cs +++ b/src/Umbraco.Web/Routing/RedirectTrackingEventHandler.cs @@ -295,8 +295,7 @@ namespace Umbraco.Web.Routing private static bool IsNotRoute(string route) { // null if content not found - // err/- if collision or anomaly or ... - return route == null || route.StartsWith("err/"); + return route == null; } // gets a value indicating whether server is 'slave' diff --git a/src/Umbraco.Web/Routing/UrlProviderExtensions.cs b/src/Umbraco.Web/Routing/UrlProviderExtensions.cs index c6e08c16c5..54ef8a42b5 100644 --- a/src/Umbraco.Web/Routing/UrlProviderExtensions.cs +++ b/src/Umbraco.Web/Routing/UrlProviderExtensions.cs @@ -1,7 +1,10 @@ using System; using System.Collections.Generic; +using System.Web.Security; using Umbraco.Core.Models; using umbraco; +using Umbraco.Core; +using Umbraco.Core.Configuration; using Umbraco.Core.Logging; namespace Umbraco.Web.Routing @@ -62,34 +65,45 @@ namespace Umbraco.Web.Routing { urls.Add(ui.Text("content", "getUrlException", umbracoContext.Security.CurrentUser)); } - else if (url.StartsWith("#err-")) + else { - // route error, report - var id = int.Parse(url.Substring(5)); - var o = umbracoContext.ContentCache.GetById(id); - string s; - if (o == null) + // test for collisions + var uri = new Uri(url.TrimEnd('/'), UriKind.RelativeOrAbsolute); + if (uri.IsAbsoluteUri == false) uri = uri.MakeAbsolute(UmbracoContext.Current.CleanedUmbracoUrl); + var pcr = new PublishedContentRequest(uri, UmbracoContext.Current.RoutingContext, UmbracoConfig.For.UmbracoSettings().WebRouting, s => Roles.Provider.GetRolesForUser(s)); + pcr.Engine.TryRouteRequest(); + + if (pcr.HasPublishedContent == false) { - s = "(unknown)"; + urls.Add(ui.Text("content", "routeError", "(error)", umbracoContext.Security.CurrentUser)); + } + else if (pcr.PublishedContent.Id != content.Id) + { + var o = pcr.PublishedContent; + string s; + if (o == null) + { + s = "(unknown)"; + } + else + { + var l = new List(); + while (o != null) + { + l.Add(o.Name); + o = o.Parent; + } + l.Reverse(); + s = "/" + string.Join("/", l) + " (id=" + pcr.PublishedContent.Id + ")"; + + } + urls.Add(ui.Text("content", "routeError", s, umbracoContext.Security.CurrentUser)); } else { - var l = new List(); - while (o != null) - { - l.Add(o.Name); - o = o.Parent; - } - l.Reverse(); - s = "/" + string.Join("/", l) + " (id=" + id + ")"; - + urls.Add(url); + urls.AddRange(urlProvider.GetOtherUrls(content.Id)); } - urls.Add(ui.Text("content", "routeError", s, umbracoContext.Security.CurrentUser)); - } - else - { - urls.Add(url); - urls.AddRange(urlProvider.GetOtherUrls(content.Id)); } return urls; } From 0e31fcf3db20e19f9f1dd790094cc067c06b5089 Mon Sep 17 00:00:00 2001 From: Stephan Date: Wed, 4 Jan 2017 15:36:29 +0100 Subject: [PATCH 13/39] U4-9337 - fix tests --- .../Routing/NiceUrlProviderTests.cs | 18 ++---------------- .../NiceUrlsProviderWithDomainsTests.cs | 13 ++----------- .../Routing/UrlsWithNestedDomains.cs | 10 +++++----- 3 files changed, 9 insertions(+), 32 deletions(-) diff --git a/src/Umbraco.Tests/Routing/NiceUrlProviderTests.cs b/src/Umbraco.Tests/Routing/NiceUrlProviderTests.cs index 075205ef5c..c6970cbeb3 100644 --- a/src/Umbraco.Tests/Routing/NiceUrlProviderTests.cs +++ b/src/Umbraco.Tests/Routing/NiceUrlProviderTests.cs @@ -72,23 +72,9 @@ namespace Umbraco.Tests.Routing var cache = routingContext.UmbracoContext.ContentCache.InnerCache as PublishedContentCache; if (cache == null) throw new Exception("Unsupported IPublishedContentCache, only the Xml one is supported."); var cachedRoutes = cache.RoutesCache.GetCachedRoutes(); - Assert.AreEqual(8, cachedRoutes.Count); - foreach (var sample in samples) - { - Assert.IsTrue(cachedRoutes.ContainsKey(sample.Key)); - Assert.AreEqual(sample.Value, cachedRoutes[sample.Key]); - } - - var cachedIds = cache.RoutesCache.GetCachedIds(); - Assert.AreEqual(8, cachedIds.Count); - - foreach (var sample in samples) - { - var key = sample.Value; - Assert.IsTrue(cachedIds.ContainsKey(key)); - Assert.AreEqual(sample.Key, cachedIds[key]); - } + // GetUrl does not write to cache + Assert.AreEqual(0, cachedRoutes.Count); } // test hideTopLevelNodeFromPath false diff --git a/src/Umbraco.Tests/Routing/NiceUrlsProviderWithDomainsTests.cs b/src/Umbraco.Tests/Routing/NiceUrlsProviderWithDomainsTests.cs index 8cc975954b..6e71efcbf3 100644 --- a/src/Umbraco.Tests/Routing/NiceUrlsProviderWithDomainsTests.cs +++ b/src/Umbraco.Tests/Routing/NiceUrlsProviderWithDomainsTests.cs @@ -303,18 +303,9 @@ namespace Umbraco.Tests.Routing var cache = routingContext.UmbracoContext.ContentCache.InnerCache as PublishedContentCache; if (cache == null) throw new Exception("Unsupported IPublishedContentCache, only the Xml one is supported."); var cachedRoutes = cache.RoutesCache.GetCachedRoutes(); - Assert.AreEqual(7, cachedRoutes.Count); - var cachedIds = cache.RoutesCache.GetCachedIds(); - Assert.AreEqual(7, cachedIds.Count); - - CheckRoute(cachedRoutes, cachedIds, 1001, "1001/"); - CheckRoute(cachedRoutes, cachedIds, 10011, "10011/"); - CheckRoute(cachedRoutes, cachedIds, 100111, "10011/1001-1-1"); - CheckRoute(cachedRoutes, cachedIds, 10012, "10012/"); - CheckRoute(cachedRoutes, cachedIds, 100121, "10012/1001-2-1"); - CheckRoute(cachedRoutes, cachedIds, 10013, "1001/1001-3"); - CheckRoute(cachedRoutes, cachedIds, 1002, "/1002"); + // GetUrl does not write to cache + Assert.AreEqual(0, cachedRoutes.Count); // use the cache Assert.AreEqual("/", routingContext.UrlProvider.GetUrl(1001, new Uri("http://domain1.com"), false)); diff --git a/src/Umbraco.Tests/Routing/UrlsWithNestedDomains.cs b/src/Umbraco.Tests/Routing/UrlsWithNestedDomains.cs index 2e868f9f44..29a60232fa 100644 --- a/src/Umbraco.Tests/Routing/UrlsWithNestedDomains.cs +++ b/src/Umbraco.Tests/Routing/UrlsWithNestedDomains.cs @@ -44,8 +44,8 @@ namespace Umbraco.Tests.Routing // check that the proper route has been cached var cache = routingContext.UmbracoContext.ContentCache.InnerCache as PublishedContentCache; if (cache == null) throw new Exception("Unsupported IPublishedContentCache, only the Xml one is supported."); - var cachedRoutes = cache.RoutesCache.GetCachedRoutes(); - Assert.AreEqual("10011/1001-1-1", cachedRoutes[100111]); + //var cachedRoutes = cache.RoutesCache.GetCachedRoutes(); + //Assert.AreEqual("10011/1001-1-1", cachedRoutes[100111]); // route a rogue url url = "http://domain1.com/1001-1/1001-1-1"; @@ -61,9 +61,9 @@ namespace Umbraco.Tests.Routing Assert.AreEqual(100111, pcr.PublishedContent.Id); // has the cache been polluted? - cachedRoutes = cache.RoutesCache.GetCachedRoutes(); - Assert.AreEqual("10011/1001-1-1", cachedRoutes[100111]); // no - //Assert.AreEqual("1001/1001-1/1001-1-1", cachedRoutes[100111]); // yes + //cachedRoutes = cache.RoutesCache.GetCachedRoutes(); + //Assert.AreEqual("10011/1001-1-1", cachedRoutes[100111]); // no + ////Assert.AreEqual("1001/1001-1/1001-1-1", cachedRoutes[100111]); // yes // what's the nice url now? Assert.AreEqual("http://domain2.com/1001-1-1/", routingContext.UrlProvider.GetUrl(100111)); // good From d5e66252dc828d82f031569a29a1d2ff03b6a174 Mon Sep 17 00:00:00 2001 From: Stephan Date: Thu, 5 Jan 2017 09:25:30 +0100 Subject: [PATCH 14/39] U4-9337 - minor simplification --- .../XmlPublishedCache/PublishedContentCache.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs index 0b027deb92..d9b0363408 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs @@ -172,15 +172,13 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache { var e = n as XmlElement; if (e == null) continue; - + var id = NavigateElementRoute(e, urlParts); if (id > 0) return id; } - if (urlParts.Length == 1) - return NavigateElementRoute(elt, urlParts); - - return -1; + if (urlParts.Length > 1) + return -1; } return NavigateElementRoute(elt, urlParts); @@ -205,7 +203,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache { var child = o as XmlElement; if (child == null) continue; - + var noNode = UseLegacySchema ? child.Name != "node" : child.GetAttributeNode("isDoc") == null; From 2041e85b9e5d2284df4cb02f59988d46921e0496 Mon Sep 17 00:00:00 2001 From: Stephan Date: Thu, 5 Jan 2017 10:46:40 +0100 Subject: [PATCH 15/39] U4-9337 - add doc and test --- src/Umbraco.Tests/Umbraco.Tests.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Umbraco.Tests/Umbraco.Tests.csproj b/src/Umbraco.Tests/Umbraco.Tests.csproj index 99a83c9c55..d90c0e6345 100644 --- a/src/Umbraco.Tests/Umbraco.Tests.csproj +++ b/src/Umbraco.Tests/Umbraco.Tests.csproj @@ -160,6 +160,7 @@ + From 89be1cf5d2ce5c7feb0d24b51c9a2914d611e4e0 Mon Sep 17 00:00:00 2001 From: Stephan Date: Thu, 5 Jan 2017 10:50:03 +0100 Subject: [PATCH 16/39] U4-9337 - with missing file... --- .../Routing/NiceUrlRoutesTests.cs | 256 ++++++++++++++++++ 1 file changed, 256 insertions(+) create mode 100644 src/Umbraco.Tests/Routing/NiceUrlRoutesTests.cs diff --git a/src/Umbraco.Tests/Routing/NiceUrlRoutesTests.cs b/src/Umbraco.Tests/Routing/NiceUrlRoutesTests.cs new file mode 100644 index 0000000000..79f2b2b64d --- /dev/null +++ b/src/Umbraco.Tests/Routing/NiceUrlRoutesTests.cs @@ -0,0 +1,256 @@ +using System; +using NUnit.Framework; +using Umbraco.Core.Configuration.UmbracoSettings; +using Umbraco.Tests.TestHelpers; +using Umbraco.Web.PublishedCache.XmlPublishedCache; +using Umbraco.Web.Routing; + +namespace Umbraco.Tests.Routing +{ + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerFixture)] + [TestFixture] + public class NiceUrlRoutesTests : BaseRoutingTest + { + #region Test Setup + + protected override void FreezeResolution() + { + SiteDomainHelperResolver.Current = new SiteDomainHelperResolver(new SiteDomainHelper()); + + base.FreezeResolution(); + } + + private IUmbracoSettingsSection _umbracoSettings; + + public override void Initialize() + { + base.Initialize(); + + //generate new mock settings and assign so we can configure in individual tests + _umbracoSettings = SettingsForTests.GenerateMockSettings(); + SettingsForTests.ConfigureSettings(_umbracoSettings); + } + + protected override string GetXmlContent(int templateId) + { + return @" + + +]> + + + + + + + + + + + + + + + + + + + + + + + +"; + } + + #endregion + + /* + * Just so it's documented somewhere, as of jan. 2017, routes obey the following pseudo-code: + +GetByRoute(route, hide = null): + + route is "[id]/[path]" + + hide = hide ?? global.hide + + root = id ? node(id) : document + + content = cached(route) ?? DetermineIdByRoute(route, hide) + + # route is "1234/path/to/content", finds "content" + # but if there is domain 5678 on "to", the *true* route of "content" is "5678/content" + # so although the route does match, we don't cache it + # there are not other reason not to cache it + + if content and no domain between root and content: + cache route + + return content + + +DetermineIdByRoute(route, hide): + + route is "[id]/[path]" + + try return NavigateRoute(id ?? 0, path, hide:hide) + return null + + +NavigateRoute(id, path, hide): + + if path: + if id: + start = node(id) + else: + start = document + + # 'navigate ... from ...' uses lowest sortOrder in case of collision + + if hide and ![id]: + # if hiding, then for "/foo" we want to look for "/[any]/foo" + for each child of start: + try return navigate path from child + + # but if it fails, we also want to try "/foo" + # fail now if more than one part eg "/foo/bar" + if path is "/[any]/...": + fail + + try return navigate path from start + + else: + if id: + return node(id) + else: + return root node with lowest sortOrder + + +GetRouteById(id): + + + route = cached(id) + if route: + return route + + # never cache the route, it may be colliding + + return DetermineRouteById(id) + + + +DetermineRouteById(id): + + + node = node(id) + + walk up from node to domain or root, assemble parts = url segments + + if !domain and global.hide: + if id.parent: + # got /top/[path]content, can remove /top + remove top part + else: + # got /content, should remove only if it is the + # node with lowest sort order + root = root node with lowest sortOrder + if root == node: + remove top part + + compose path from parts + route = assemble "[domain.id]/[path]" + return route + + */ + + /* + * The Xml structure for the following tests is: + * + * root + * A 1000 + * B 1001 + * C 1002 + * D 1003 + * X 2000 + * Y 2001 + * Z 2002 + * A 2003 + * B 2004 + * C 2005 + * E 2006 + * + * And the tests should verify all the quirks that are due to + * hideTopLevelFromPath + */ + + [TestCase(1000, false, "/a")] + [TestCase(1001, false, "/a/b")] + [TestCase(1002, false, "/a/b/c")] + [TestCase(1003, false, "/a/b/c/d")] + [TestCase(2000, false, "/x")] + [TestCase(2001, false, "/x/y")] + [TestCase(2002, false, "/x/y/z")] + [TestCase(2003, false, "/x/a")] + [TestCase(2004, false, "/x/b")] + [TestCase(2005, false, "/x/b/c")] + [TestCase(2006, false, "/x/b/e")] + [TestCase(1000, true, "/")] + [TestCase(1001, true, "/b")] + [TestCase(1002, true, "/b/c")] + [TestCase(1003, true, "/b/c/d")] + [TestCase(2000, true, "/x")] + [TestCase(2001, true, "/y")] + [TestCase(2002, true, "/y/z")] + [TestCase(2003, true, "/a")] + [TestCase(2004, true, "/b")] // collision! + [TestCase(2005, true, "/b/c")] // collision! + [TestCase(2006, true, "/b/e")] // risky! + public void GetRouteById(int id, bool hide, string expected) + { + var umbracoContext = GetUmbracoContext("/test", 0); + var cache = umbracoContext.ContentCache.InnerCache as PublishedContentCache; + if (cache == null) throw new Exception("Unsupported IPublishedContentCache, only the Xml one is supported."); + + SettingsForTests.HideTopLevelNodeFromPath = hide; + + var route = cache.GetRouteById(umbracoContext, false, id); + Assert.AreEqual(expected, route); + } + + [TestCase("/", false, 1000)] + [TestCase("/a", false, 1000)] // yes! + [TestCase("/a/b", false, 1001)] + [TestCase("/a/b/c", false, 1002)] + [TestCase("/a/b/c/d", false, 1003)] + [TestCase("/x", false, 2000)] + [TestCase("/", true, 1000)] + [TestCase("/a", true, 2003)] + [TestCase("/a/b", true, -1)] + [TestCase("/x", true, 2000)] // oops! + [TestCase("/x/y", true, -1)] // yes! + [TestCase("/y", true, 2001)] + [TestCase("/y/z", true, 2002)] + [TestCase("/b", true, 1001)] // (hence the 2004 collision) + [TestCase("/b/c", true, 1002)] // (hence the 2005 collision) + public void GetByRoute(string route, bool hide, int expected) + { + var umbracoContext = GetUmbracoContext("/test", 0); + var cache = umbracoContext.ContentCache.InnerCache as PublishedContentCache; + if (cache == null) throw new Exception("Unsupported IPublishedContentCache, only the Xml one is supported."); + + SettingsForTests.HideTopLevelNodeFromPath = hide; + + var content = cache.GetByRoute(umbracoContext, false, route); + if (expected < 0) + { + Assert.IsNull(content); + } + else + { + Assert.IsNotNull(content); + Assert.AreEqual(expected, content.Id); + } + } + } +} From 7ebf51abb700a3684d39c506c35bba4035eaca7e Mon Sep 17 00:00:00 2001 From: Stephan Date: Thu, 5 Jan 2017 14:58:05 +0100 Subject: [PATCH 17/39] deploy-102 - guid the relation types --- src/Umbraco.Core/Constants-ObjectTypes.cs | 10 ++++ .../Models/Rdbms/RelationTypeDto.cs | 4 ++ src/Umbraco.Core/Models/UmbracoObjectTypes.cs | 9 +++- .../Factories/RelationTypeFactory.cs | 6 ++- .../Migrations/Initial/BaseDataCreation.cs | 8 ++- .../AddRelationTypeUniqueIdColumn.cs | 49 +++++++++++++++++++ .../Interfaces/IRelationTypeRepository.cs | 9 ++-- .../Repositories/RelationTypeRepository.cs | 20 ++++++++ src/Umbraco.Core/Services/IRelationService.cs | 7 +++ src/Umbraco.Core/Services/RelationService.cs | 13 +++++ src/Umbraco.Core/Umbraco.Core.csproj | 1 + 11 files changed, 126 insertions(+), 10 deletions(-) create mode 100644 src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenSixZero/AddRelationTypeUniqueIdColumn.cs diff --git a/src/Umbraco.Core/Constants-ObjectTypes.cs b/src/Umbraco.Core/Constants-ObjectTypes.cs index 3f9974166c..8edc552012 100644 --- a/src/Umbraco.Core/Constants-ObjectTypes.cs +++ b/src/Umbraco.Core/Constants-ObjectTypes.cs @@ -152,6 +152,16 @@ namespace Umbraco.Core /// Guid for a Lock object. /// public static readonly Guid LockObjectGuid = new Guid(LockObject); + + /// + /// Guid for a relation type. + /// + public const string RelationType = "B1988FAD-8675-4F47-915A-B3A602BC5D8D"; + + /// + /// Guid for a relation type. + /// + public static readonly Guid RelationTypeGuid = new Guid(RelationType); } } } \ No newline at end of file diff --git a/src/Umbraco.Core/Models/Rdbms/RelationTypeDto.cs b/src/Umbraco.Core/Models/Rdbms/RelationTypeDto.cs index 8a6eb5c02a..54052f58a3 100644 --- a/src/Umbraco.Core/Models/Rdbms/RelationTypeDto.cs +++ b/src/Umbraco.Core/Models/Rdbms/RelationTypeDto.cs @@ -15,6 +15,10 @@ namespace Umbraco.Core.Models.Rdbms [PrimaryKeyColumn(IdentitySeed = NodeIdSeed)] public int Id { get; set; } + [Column("typeUniqueId")] + [Index(IndexTypes.UniqueNonClustered, Name = "IX_umbracoRelationType_UniqueId")] + public Guid UniqueId { get; set; } + [Column("dual")] public bool Dual { get; set; } diff --git a/src/Umbraco.Core/Models/UmbracoObjectTypes.cs b/src/Umbraco.Core/Models/UmbracoObjectTypes.cs index 2be2010301..3909af2a55 100644 --- a/src/Umbraco.Core/Models/UmbracoObjectTypes.cs +++ b/src/Umbraco.Core/Models/UmbracoObjectTypes.cs @@ -130,8 +130,13 @@ namespace Umbraco.Core.Models /// [UmbracoObjectType(Constants.ObjectTypes.DataTypeContainer)] [FriendlyName("Data Type Container")] - DataTypeContainer - + DataTypeContainer, + /// + /// Relation type + /// + [UmbracoObjectType(Constants.ObjectTypes.RelationType)] + [FriendlyName("Relation Type")] + RelationType } } \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Factories/RelationTypeFactory.cs b/src/Umbraco.Core/Persistence/Factories/RelationTypeFactory.cs index 98d4f30042..b112535817 100644 --- a/src/Umbraco.Core/Persistence/Factories/RelationTypeFactory.cs +++ b/src/Umbraco.Core/Persistence/Factories/RelationTypeFactory.cs @@ -16,6 +16,7 @@ namespace Umbraco.Core.Persistence.Factories entity.DisableChangeTracking(); entity.Id = dto.Id; + entity.Key = dto.UniqueId; entity.IsBidirectional = dto.Dual; entity.Name = dto.Name; @@ -38,10 +39,13 @@ namespace Umbraco.Core.Persistence.Factories ChildObjectType = entity.ChildObjectType, Dual = entity.IsBidirectional, Name = entity.Name, - ParentObjectType = entity.ParentObjectType + ParentObjectType = entity.ParentObjectType, + UniqueId = entity.Key }; if (entity.HasIdentity) + { dto.Id = entity.Id; + } return dto; } diff --git a/src/Umbraco.Core/Persistence/Migrations/Initial/BaseDataCreation.cs b/src/Umbraco.Core/Persistence/Migrations/Initial/BaseDataCreation.cs index 6128096943..9b5d2bc2c8 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Initial/BaseDataCreation.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Initial/BaseDataCreation.cs @@ -292,8 +292,12 @@ namespace Umbraco.Core.Persistence.Migrations.Initial private void CreateUmbracoRelationTypeData() { - _database.Insert("umbracoRelationType", "id", false, new RelationTypeDto { Id = 1, Alias = Constants.Conventions.RelationTypes.RelateDocumentOnCopyAlias, ChildObjectType = new Guid(Constants.ObjectTypes.Document), ParentObjectType = new Guid(Constants.ObjectTypes.Document), Dual = true, Name = Constants.Conventions.RelationTypes.RelateDocumentOnCopyName }); - _database.Insert("umbracoRelationType", "id", false, new RelationTypeDto { Id = 2, Alias = Constants.Conventions.RelationTypes.RelateParentDocumentOnDeleteAlias, ChildObjectType = new Guid(Constants.ObjectTypes.Document), ParentObjectType = new Guid(Constants.ObjectTypes.Document), Dual = false, Name = Constants.Conventions.RelationTypes.RelateParentDocumentOnDeleteName }); + var relationType = new RelationTypeDto { Id = 1, Alias = Constants.Conventions.RelationTypes.RelateDocumentOnCopyAlias, ChildObjectType = new Guid(Constants.ObjectTypes.Document), ParentObjectType = new Guid(Constants.ObjectTypes.Document), Dual = true, Name = Constants.Conventions.RelationTypes.RelateDocumentOnCopyName }; + relationType.UniqueId = (relationType.Alias + "____" + relationType.Name).ToGuid(); + _database.Insert("umbracoRelationType", "id", false, relationType); + relationType = new RelationTypeDto { Id = 2, Alias = Constants.Conventions.RelationTypes.RelateParentDocumentOnDeleteAlias, ChildObjectType = new Guid(Constants.ObjectTypes.Document), ParentObjectType = new Guid(Constants.ObjectTypes.Document), Dual = false, Name = Constants.Conventions.RelationTypes.RelateParentDocumentOnDeleteName }; + relationType.UniqueId = (relationType.Alias + "____" + relationType.Name).ToGuid(); + _database.Insert("umbracoRelationType", "id", false, relationType); } private void CreateCmsTaskTypeData() diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenSixZero/AddRelationTypeUniqueIdColumn.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenSixZero/AddRelationTypeUniqueIdColumn.cs new file mode 100644 index 0000000000..8a6641c523 --- /dev/null +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenSixZero/AddRelationTypeUniqueIdColumn.cs @@ -0,0 +1,49 @@ +using System; +using System.Linq; +using Umbraco.Core.Configuration; +using Umbraco.Core.Logging; +using Umbraco.Core.Persistence.SqlSyntax; + +namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenSixZero +{ + [Migration("7.6.0", 0, GlobalSettings.UmbracoMigrationName)] + public class AddRelationTypeUniqueIdColumn : MigrationBase + { + public AddRelationTypeUniqueIdColumn(ISqlSyntaxProvider sqlSyntax, ILogger logger) + : base(sqlSyntax, logger) + { } + + public override void Up() + { + var columns = SqlSyntax.GetColumnsInSchema(Context.Database).ToArray(); + + if (columns.Any(x => x.TableName.InvariantEquals("umbracoRelationType") && x.ColumnName.InvariantEquals("typeUniqueId")) == false) + { + Create.Column("typeUniqueId").OnTable("umbracoRelationType").AsGuid().Nullable(); + Execute.Code(UpdateRelationTypeGuids); + Alter.Table("umbracoRelationType").AlterColumn("typeUniqueId").AsGuid().NotNullable(); + Create.Index("IX_umbracoRelationType_UniqueId").OnTable("umbracoRelationType").OnColumn("typeUniqueId") + .Ascending() + .WithOptions().NonClustered() + .WithOptions().Unique(); + } + } + + private static string UpdateRelationTypeGuids(Database database) + { + var updates = database.Query("SELECT id, alias, name FROM umbracoRelationType") + .Select(relationType => Tuple.Create((int) relationType.id, ((string) relationType.alias + "____" + (string) relationType.name).ToGuid())) + .ToList(); + + foreach (var update in updates) + database.Execute("UPDATE umbracoRelationType set typeUniqueId=@guid WHERE id=@id", new { guid = update.Item2, id = update.Item1 }); + + return string.Empty; + } + + public override void Down() + { + throw new NotImplementedException(); + } + } +} diff --git a/src/Umbraco.Core/Persistence/Repositories/Interfaces/IRelationTypeRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Interfaces/IRelationTypeRepository.cs index d28f81bce0..0cf6357d24 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Interfaces/IRelationTypeRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Interfaces/IRelationTypeRepository.cs @@ -1,9 +1,8 @@ -using Umbraco.Core.Models; +using System; +using Umbraco.Core.Models; namespace Umbraco.Core.Persistence.Repositories { - public interface IRelationTypeRepository : IRepositoryQueryable - { - - } + public interface IRelationTypeRepository : IRepositoryQueryable, IReadRepository + { } } \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Repositories/RelationTypeRepository.cs b/src/Umbraco.Core/Persistence/Repositories/RelationTypeRepository.cs index c0a110feca..2c54897ff7 100644 --- a/src/Umbraco.Core/Persistence/Repositories/RelationTypeRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/RelationTypeRepository.cs @@ -44,6 +44,17 @@ namespace Umbraco.Core.Persistence.Repositories return GetAll().FirstOrDefault(x => x.Id == id); } + public IRelationType Get(Guid id) + { + // use the underlying GetAll which will force cache all content types + return GetAll().FirstOrDefault(x => x.Key == id); + } + + public bool Exists(Guid id) + { + return Get(id) != null; + } + protected override IEnumerable PerformGetAll(params int[] ids) { var sql = GetBaseQuery(false); @@ -57,6 +68,15 @@ namespace Umbraco.Core.Persistence.Repositories return dtos.Select(x => DtoToEntity(x, factory)); } + public IEnumerable GetAll(params Guid[] ids) + { + // should not happen due to the cache policy + if (ids.Any()) + throw new NotImplementedException(); + + return GetAll(new int[0]); + } + protected override IEnumerable PerformGetByQuery(IQuery query) { var sqlClause = GetBaseQuery(false); diff --git a/src/Umbraco.Core/Services/IRelationService.cs b/src/Umbraco.Core/Services/IRelationService.cs index 3719993a75..5fb1f3c8cc 100644 --- a/src/Umbraco.Core/Services/IRelationService.cs +++ b/src/Umbraco.Core/Services/IRelationService.cs @@ -21,6 +21,13 @@ namespace Umbraco.Core.Services /// A object IRelationType GetRelationTypeById(int id); + /// + /// Gets a by its Id + /// + /// Id of the + /// A object + IRelationType GetRelationTypeById(Guid id); + /// /// Gets a by its Alias /// diff --git a/src/Umbraco.Core/Services/RelationService.cs b/src/Umbraco.Core/Services/RelationService.cs index b4a37fc1d1..69f79e756e 100644 --- a/src/Umbraco.Core/Services/RelationService.cs +++ b/src/Umbraco.Core/Services/RelationService.cs @@ -48,6 +48,19 @@ namespace Umbraco.Core.Services } } + /// + /// Gets a by its Id + /// + /// Id of the + /// A object + public IRelationType GetRelationTypeById(Guid id) + { + using (var repository = RepositoryFactory.CreateRelationTypeRepository(UowProvider.GetUnitOfWork())) + { + return repository.Get(id); + } + } + /// /// Gets a by its Alias /// diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index c128051bfd..0741470f51 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -438,6 +438,7 @@ + From 59cd4b5c5c0e49643b495776509ba3ac8478369e Mon Sep 17 00:00:00 2001 From: Shannon Date: Fri, 6 Jan 2017 17:40:03 +1100 Subject: [PATCH 18/39] Fixes more allocations at the config level --- .../ContentScriptEditorElement.cs | 26 ++---------- .../ImagingAutoFillUploadFieldElement.cs | 34 +++------------ .../UmbracoSettings/LoggingElement.cs | 42 +++---------------- .../UmbracoSettings/NotificationsElement.cs | 10 +---- .../UmbracoSettings/RequestHandlerElement.cs | 18 ++------ .../UmbracoSettings/SecurityElement.cs | 42 +++---------------- .../UmbracoSettings/TemplatesElement.cs | 34 +++------------ 7 files changed, 31 insertions(+), 175 deletions(-) diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentScriptEditorElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentScriptEditorElement.cs index 0d14609caa..f60e964a04 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentScriptEditorElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentScriptEditorElement.cs @@ -3,42 +3,24 @@ using System.Configuration; namespace Umbraco.Core.Configuration.UmbracoSettings { - internal class ContentScriptEditorElement : ConfigurationElement + internal class ContentScriptEditorElement : UmbracoConfigurationElement { [ConfigurationProperty("scriptFolderPath")] internal InnerTextConfigurationElement ScriptFolderPath { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["scriptFolderPath"], - //set the default - "/scripts"); - } + get { return GetOptionalTextElement("scriptFolderPath", "/scripts"); } } [ConfigurationProperty("scriptFileTypes")] internal OptionalCommaDelimitedConfigurationElement ScriptFileTypes { - get - { - return new OptionalCommaDelimitedConfigurationElement( - (OptionalCommaDelimitedConfigurationElement)this["scriptFileTypes"], - //set the default - new[] { "js", "xml" }); - } + get { return GetOptionalDelimitedElement("scriptFileTypes", new[] {"js", "xml"}); } } [ConfigurationProperty("scriptDisableEditor")] internal InnerTextConfigurationElement ScriptEditorDisable { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement) this["scriptDisableEditor"], - //set the default - false); - } + get { return GetOptionalTextElement("scriptDisableEditor", false); } } } diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ImagingAutoFillUploadFieldElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ImagingAutoFillUploadFieldElement.cs index 0dfc4afc00..eafe43817d 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/ImagingAutoFillUploadFieldElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ImagingAutoFillUploadFieldElement.cs @@ -2,7 +2,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings { - internal class ImagingAutoFillUploadFieldElement : ConfigurationElement, IImagingAutoFillUploadField + internal class ImagingAutoFillUploadFieldElement : UmbracoConfigurationElement, IImagingAutoFillUploadField { /// /// Allow setting internally so we can create a default @@ -17,49 +17,25 @@ namespace Umbraco.Core.Configuration.UmbracoSettings [ConfigurationProperty("widthFieldAlias")] internal InnerTextConfigurationElement WidthFieldAlias { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["widthFieldAlias"], - //set the default - "umbracoWidth"); - } + get { return GetOptionalTextElement("widthFieldAlias", "umbracoWidth"); } } [ConfigurationProperty("heightFieldAlias")] internal InnerTextConfigurationElement HeightFieldAlias { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["heightFieldAlias"], - //set the default - "umbracoHeight"); - } + get { return GetOptionalTextElement("heightFieldAlias", "umbracoHeight"); } } [ConfigurationProperty("lengthFieldAlias")] internal InnerTextConfigurationElement LengthFieldAlias { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["lengthFieldAlias"], - //set the default - "umbracoBytes"); - } + get { return GetOptionalTextElement("lengthFieldAlias", "umbracoBytes"); } } [ConfigurationProperty("extensionFieldAlias")] internal InnerTextConfigurationElement ExtensionFieldAlias { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["extensionFieldAlias"], - //set the default - "umbracoExtension"); - } + get { return GetOptionalTextElement("extensionFieldAlias", "umbracoExtension"); } } string IImagingAutoFillUploadField.Alias diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/LoggingElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/LoggingElement.cs index f95a9c7e76..39e6327b3a 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/LoggingElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/LoggingElement.cs @@ -3,67 +3,37 @@ using System.Configuration; namespace Umbraco.Core.Configuration.UmbracoSettings { - internal class LoggingElement : ConfigurationElement, ILoggingSection + internal class LoggingElement : UmbracoConfigurationElement, ILoggingSection { [ConfigurationProperty("autoCleanLogs")] internal InnerTextConfigurationElement AutoCleanLogs { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["autoCleanLogs"], - //set the default - false); - } + get { return GetOptionalTextElement("autoCleanLogs", false); } } [ConfigurationProperty("enableLogging")] internal InnerTextConfigurationElement EnableLogging { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["enableLogging"], - //set the default - true); - } + get { return GetOptionalTextElement("enableLogging", true); } } [ConfigurationProperty("enableAsyncLogging")] internal InnerTextConfigurationElement EnableAsyncLogging { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["enableAsyncLogging"], - //set the default - true); - } + get { return GetOptionalTextElement("enableAsyncLogging", true); } } [ConfigurationProperty("cleaningMiliseconds")] internal InnerTextConfigurationElement CleaningMiliseconds { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["cleaningMiliseconds"], - //set the default - -1); - } + get { return GetOptionalTextElement("cleaningMiliseconds", -1); } } [ConfigurationProperty("maxLogAge")] internal InnerTextConfigurationElement MaxLogAge { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["maxLogAge"], - //set the default - -1); - } + get { return GetOptionalTextElement("maxLogAge", -1); } } [ConfigurationCollection(typeof(DisabledLogTypesCollection), AddItemName = "logTypeAlias")] diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/NotificationsElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/NotificationsElement.cs index 16eb943887..89e3f447ee 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/NotificationsElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/NotificationsElement.cs @@ -2,7 +2,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings { - internal class NotificationsElement : ConfigurationElement + internal class NotificationsElement : UmbracoConfigurationElement { [ConfigurationProperty("email")] internal InnerTextConfigurationElement NotificationEmailAddress @@ -13,13 +13,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings [ConfigurationProperty("disableHtmlEmail")] internal InnerTextConfigurationElement DisableHtmlEmail { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement) this["disableHtmlEmail"], - //set the default - false); - } + get { return GetOptionalTextElement("disableHtmlEmail", false); } } } diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/RequestHandlerElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/RequestHandlerElement.cs index 9dc4a94824..779d33c8b8 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/RequestHandlerElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/RequestHandlerElement.cs @@ -5,30 +5,18 @@ using System.Collections.Generic; namespace Umbraco.Core.Configuration.UmbracoSettings { - internal class RequestHandlerElement : ConfigurationElement, IRequestHandlerSection + internal class RequestHandlerElement : UmbracoConfigurationElement, IRequestHandlerSection { [ConfigurationProperty("useDomainPrefixes")] public InnerTextConfigurationElement UseDomainPrefixes { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["useDomainPrefixes"], - //set the default - false); - } + get { return GetOptionalTextElement("useDomainPrefixes", false); } } [ConfigurationProperty("addTrailingSlash")] public InnerTextConfigurationElement AddTrailingSlash { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["addTrailingSlash"], - //set the default - true); - } + get { return GetOptionalTextElement("addTrailingSlash", true); } } private UrlReplacingElement _defaultUrlReplacing; diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/SecurityElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/SecurityElement.cs index f280b3e20c..ddb168ddbd 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/SecurityElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/SecurityElement.cs @@ -2,66 +2,36 @@ namespace Umbraco.Core.Configuration.UmbracoSettings { - internal class SecurityElement : ConfigurationElement, ISecuritySection + internal class SecurityElement : UmbracoConfigurationElement, ISecuritySection { [ConfigurationProperty("keepUserLoggedIn")] internal InnerTextConfigurationElement KeepUserLoggedIn { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["keepUserLoggedIn"], - //set the default - true); - } + get { return GetOptionalTextElement("keepUserLoggedIn", true); } } [ConfigurationProperty("hideDisabledUsersInBackoffice")] internal InnerTextConfigurationElement HideDisabledUsersInBackoffice { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["hideDisabledUsersInBackoffice"], - //set the default - false); - } + get { return GetOptionalTextElement("hideDisabledUsersInBackoffice", false); } } [ConfigurationProperty("allowPasswordReset")] internal InnerTextConfigurationElement AllowPasswordReset { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["allowPasswordReset"], - //set the default - true); - } + get { return GetOptionalTextElement("allowPasswordReset", true); } } [ConfigurationProperty("authCookieName")] internal InnerTextConfigurationElement AuthCookieName { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["authCookieName"], - //set the default - Constants.Web.AuthCookieName); - } + get { return GetOptionalTextElement("authCookieName", Constants.Web.AuthCookieName); } } [ConfigurationProperty("authCookieDomain")] internal InnerTextConfigurationElement AuthCookieDomain { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["authCookieDomain"], - //set the default - null); - } + get { return GetOptionalTextElement("authCookieDomain", null); } } bool ISecuritySection.KeepUserLoggedIn diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/TemplatesElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/TemplatesElement.cs index c7eb659766..4e249df3a2 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/TemplatesElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/TemplatesElement.cs @@ -3,55 +3,31 @@ using System.Configuration; namespace Umbraco.Core.Configuration.UmbracoSettings { - internal class TemplatesElement : ConfigurationElement, ITemplatesSection + internal class TemplatesElement : UmbracoConfigurationElement, ITemplatesSection { [ConfigurationProperty("useAspNetMasterPages")] internal InnerTextConfigurationElement UseAspNetMasterPages { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["useAspNetMasterPages"], - //set the default - true); - } + get { return GetOptionalTextElement("useAspNetMasterPages", true); } } [ConfigurationProperty("enableSkinSupport")] internal InnerTextConfigurationElement EnableSkinSupport { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["enableSkinSupport"], - //set the default - true); - } + get { return GetOptionalTextElement("enableSkinSupport", true); } } [ConfigurationProperty("defaultRenderingEngine", IsRequired = true)] internal InnerTextConfigurationElement DefaultRenderingEngine { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["defaultRenderingEngine"], - //set the default - RenderingEngine.Mvc); - } + get { return GetOptionalTextElement("defaultRenderingEngine", RenderingEngine.Mvc); } } [Obsolete("This has no affect and will be removed in future versions")] [ConfigurationProperty("enableTemplateFolders")] internal InnerTextConfigurationElement EnableTemplateFolders { - get - { - return new OptionalInnerTextConfigurationElement( - (InnerTextConfigurationElement)this["enableTemplateFolders"], - //set the default - false); - } + get { return GetOptionalTextElement("enableTemplateFolders", false); } } bool ITemplatesSection.UseAspNetMasterPages From aadd0c91297d648ba9876adcb9d6c4e7d6359185 Mon Sep 17 00:00:00 2001 From: Stephan Date: Fri, 6 Jan 2017 09:12:25 +0100 Subject: [PATCH 19/39] U4-9337 - asymmetric route caching --- .../Routing/NiceUrlProviderTests.cs | 28 ++++--- .../Routing/NiceUrlRoutesTests.cs | 81 +++++++++++++++++-- .../NiceUrlsProviderWithDomainsTests.cs | 23 ++++-- .../Routing/UrlsWithNestedDomains.cs | 16 ++-- .../PublishedContentCache.cs | 18 +++-- .../XmlPublishedCache/RoutesCache.cs | 21 +++-- 6 files changed, 138 insertions(+), 49 deletions(-) diff --git a/src/Umbraco.Tests/Routing/NiceUrlProviderTests.cs b/src/Umbraco.Tests/Routing/NiceUrlProviderTests.cs index c6970cbeb3..a8e5b1e64d 100644 --- a/src/Umbraco.Tests/Routing/NiceUrlProviderTests.cs +++ b/src/Umbraco.Tests/Routing/NiceUrlProviderTests.cs @@ -32,7 +32,7 @@ namespace Umbraco.Tests.Routing } /// - /// This checks that when we retrieve a NiceUrl for multiple items that there are no issues with cache overlap + /// This checks that when we retrieve a NiceUrl for multiple items that there are no issues with cache overlap /// and that they are all cached correctly. /// [Test] @@ -71,11 +71,19 @@ namespace Umbraco.Tests.Routing var cache = routingContext.UmbracoContext.ContentCache.InnerCache as PublishedContentCache; if (cache == null) throw new Exception("Unsupported IPublishedContentCache, only the Xml one is supported."); - var cachedRoutes = cache.RoutesCache.GetCachedRoutes(); - // GetUrl does not write to cache - Assert.AreEqual(0, cachedRoutes.Count); - } + var cachedRoutes = cache.RoutesCache.GetCachedRoutes(); + Assert.AreEqual(8, cachedRoutes.Count); + + foreach (var sample in samples) + { + Assert.IsTrue(cachedRoutes.ContainsKey(sample.Key)); + Assert.AreEqual(sample.Value, cachedRoutes[sample.Key]); + } + + var cachedIds = cache.RoutesCache.GetCachedIds(); + Assert.AreEqual(0, cachedIds.Count); + } // test hideTopLevelNodeFromPath false [TestCase(1046, "/home/")] @@ -133,10 +141,10 @@ namespace Umbraco.Tests.Routing var routingContext = GetRoutingContext("http://example.com/test", 1111, umbracoSettings: _umbracoSettings); - + Assert.AreEqual("/home/sub1/custom-sub-1/", routingContext.UrlProvider.GetUrl(1177)); - + requestMock.Setup(x => x.UseDomainPrefixes).Returns(true); Assert.AreEqual("http://example.com/home/sub1/custom-sub-1/", routingContext.UrlProvider.GetUrl(1177)); @@ -159,14 +167,14 @@ namespace Umbraco.Tests.Routing Assert.AreEqual("#", routingContext.UrlProvider.GetUrl(999999)); - requestMock.Setup(x => x.UseDomainPrefixes).Returns(true); - + requestMock.Setup(x => x.UseDomainPrefixes).Returns(true); + Assert.AreEqual("#", routingContext.UrlProvider.GetUrl(999999)); requestMock.Setup(x => x.UseDomainPrefixes).Returns(false); routingContext.UrlProvider.Mode = UrlProviderMode.Absolute; - + Assert.AreEqual("#", routingContext.UrlProvider.GetUrl(999999)); } } diff --git a/src/Umbraco.Tests/Routing/NiceUrlRoutesTests.cs b/src/Umbraco.Tests/Routing/NiceUrlRoutesTests.cs index 79f2b2b64d..131107e8e6 100644 --- a/src/Umbraco.Tests/Routing/NiceUrlRoutesTests.cs +++ b/src/Umbraco.Tests/Routing/NiceUrlRoutesTests.cs @@ -7,6 +7,10 @@ using Umbraco.Web.Routing; namespace Umbraco.Tests.Routing { + // purpose: test the values returned by PublishedContentCache.GetRouteById + // and .GetByRoute (no caching at all, just routing nice urls) including all + // the quirks due to hideTopLevelFromPath and backward compatibility. + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerFixture)] [TestFixture] public class NiceUrlRoutesTests : BaseRoutingTest @@ -85,7 +89,7 @@ GetByRoute(route, hide = null): # there are not other reason not to cache it if content and no domain between root and content: - cache route + cache route (as trusted) return content @@ -136,7 +140,11 @@ GetRouteById(id): # never cache the route, it may be colliding - return DetermineRouteById(id) + route = DetermineRouteById(id) + if route: + cache route (as not trusted) + + return route @@ -180,8 +188,6 @@ DetermineRouteById(id): * C 2005 * E 2006 * - * And the tests should verify all the quirks that are due to - * hideTopLevelFromPath */ [TestCase(1000, false, "/a")] @@ -214,10 +220,40 @@ DetermineRouteById(id): SettingsForTests.HideTopLevelNodeFromPath = hide; - var route = cache.GetRouteById(umbracoContext, false, id); + const bool preview = true; // make sure we don't cache + var route = cache.GetRouteById(umbracoContext, preview, id); Assert.AreEqual(expected, route); } + [Test] + public void GetRouteByIdCache() + { + var umbracoContext = GetUmbracoContext("/test", 0); + var cache = umbracoContext.ContentCache.InnerCache as PublishedContentCache; + if (cache == null) throw new Exception("Unsupported IPublishedContentCache, only the Xml one is supported."); + + SettingsForTests.HideTopLevelNodeFromPath = false; + + // make sure we cache + PublishedContentCache.UnitTesting = false; + const bool preview = false; + + var route = cache.GetRouteById(umbracoContext, preview, 1000); + Assert.AreEqual("/a", route); + + // GetRouteById registers a non-trusted route, which is cached for + // id -> route queries (fast GetUrl) but *not* for route -> id + // queries (safe inbound routing) + + var cachedRoutes = cache.RoutesCache.GetCachedRoutes(); + Assert.AreEqual(1, cachedRoutes.Count); + Assert.IsTrue(cachedRoutes.ContainsKey(1000)); + Assert.AreEqual("/a", cachedRoutes[1000]); + + var cachedIds = cache.RoutesCache.GetCachedIds(); + Assert.AreEqual(0, cachedIds.Count); + } + [TestCase("/", false, 1000)] [TestCase("/a", false, 1000)] // yes! [TestCase("/a/b", false, 1001)] @@ -241,7 +277,8 @@ DetermineRouteById(id): SettingsForTests.HideTopLevelNodeFromPath = hide; - var content = cache.GetByRoute(umbracoContext, false, route); + const bool preview = true; // make sure we don't cache + var content = cache.GetByRoute(umbracoContext, preview, route); if (expected < 0) { Assert.IsNull(content); @@ -252,5 +289,37 @@ DetermineRouteById(id): Assert.AreEqual(expected, content.Id); } } + + [Test] + public void GetByRouteCache() + { + var umbracoContext = GetUmbracoContext("/test", 0); + var cache = umbracoContext.ContentCache.InnerCache as PublishedContentCache; + if (cache == null) throw new Exception("Unsupported IPublishedContentCache, only the Xml one is supported."); + + SettingsForTests.HideTopLevelNodeFromPath = false; + + // make sure we cache + PublishedContentCache.UnitTesting = false; + const bool preview = false; + + var content = cache.GetByRoute(umbracoContext, preview, "/a/b/c"); + Assert.IsNotNull(content); + Assert.AreEqual(1002, content.Id); + + // GetByRoute registers a trusted route, which is cached both for + // id -> route queries (fast GetUrl) and for route -> id queries + // (fast inbound routing) + + var cachedRoutes = cache.RoutesCache.GetCachedRoutes(); + Assert.AreEqual(1, cachedRoutes.Count); + Assert.IsTrue(cachedRoutes.ContainsKey(1002)); + Assert.AreEqual("/a/b/c", cachedRoutes[1002]); + + var cachedIds = cache.RoutesCache.GetCachedIds(); + Assert.AreEqual(1, cachedIds.Count); + Assert.IsTrue(cachedIds.ContainsKey("/a/b/c")); + Assert.AreEqual(1002, cachedIds["/a/b/c"]); + } } } diff --git a/src/Umbraco.Tests/Routing/NiceUrlsProviderWithDomainsTests.cs b/src/Umbraco.Tests/Routing/NiceUrlsProviderWithDomainsTests.cs index 6e71efcbf3..ab25e0b43c 100644 --- a/src/Umbraco.Tests/Routing/NiceUrlsProviderWithDomainsTests.cs +++ b/src/Umbraco.Tests/Routing/NiceUrlsProviderWithDomainsTests.cs @@ -79,7 +79,7 @@ namespace Umbraco.Tests.Routing protected override string GetXmlContent(int templateId) { return @" - ]> @@ -302,10 +302,20 @@ namespace Umbraco.Tests.Routing var cache = routingContext.UmbracoContext.ContentCache.InnerCache as PublishedContentCache; if (cache == null) throw new Exception("Unsupported IPublishedContentCache, only the Xml one is supported."); - var cachedRoutes = cache.RoutesCache.GetCachedRoutes(); - // GetUrl does not write to cache - Assert.AreEqual(0, cachedRoutes.Count); + var cachedRoutes = cache.RoutesCache.GetCachedRoutes(); + Assert.AreEqual(7, cachedRoutes.Count); + + var cachedIds = cache.RoutesCache.GetCachedIds(); + Assert.AreEqual(0, cachedIds.Count); + + CheckRoute(cachedRoutes, cachedIds, 1001, "1001/"); + CheckRoute(cachedRoutes, cachedIds, 10011, "10011/"); + CheckRoute(cachedRoutes, cachedIds, 100111, "10011/1001-1-1"); + CheckRoute(cachedRoutes, cachedIds, 10012, "10012/"); + CheckRoute(cachedRoutes, cachedIds, 100121, "10012/1001-2-1"); + CheckRoute(cachedRoutes, cachedIds, 10013, "1001/1001-3"); + CheckRoute(cachedRoutes, cachedIds, 1002, "/1002"); // use the cache Assert.AreEqual("/", routingContext.UrlProvider.GetUrl(1001, new Uri("http://domain1.com"), false)); @@ -319,12 +329,11 @@ namespace Umbraco.Tests.Routing Assert.AreEqual("http://domain1.com/fr/1001-2-1/", routingContext.UrlProvider.GetUrl(100121, new Uri("http://domain2.com"), false)); } - void CheckRoute(IDictionary routes, IDictionary ids, int id, string route) + private static void CheckRoute(IDictionary routes, IDictionary ids, int id, string route) { Assert.IsTrue(routes.ContainsKey(id)); Assert.AreEqual(route, routes[id]); - Assert.IsTrue(ids.ContainsKey(route)); - Assert.AreEqual(id, ids[route]); + Assert.IsFalse(ids.ContainsKey(route)); } [Test] diff --git a/src/Umbraco.Tests/Routing/UrlsWithNestedDomains.cs b/src/Umbraco.Tests/Routing/UrlsWithNestedDomains.cs index 29a60232fa..19420e3120 100644 --- a/src/Umbraco.Tests/Routing/UrlsWithNestedDomains.cs +++ b/src/Umbraco.Tests/Routing/UrlsWithNestedDomains.cs @@ -26,7 +26,7 @@ namespace Umbraco.Tests.Routing public void DoNotPolluteCache() { SettingsForTests.UseDirectoryUrls = true; - SettingsForTests.HideTopLevelNodeFromPath = false; // ignored w/domains + SettingsForTests.HideTopLevelNodeFromPath = false; // ignored w/domains var settings = SettingsForTests.GenerateMockSettings(); var request = Mock.Get(settings.RequestHandler); @@ -36,7 +36,7 @@ namespace Umbraco.Tests.Routing RoutingContext routingContext; string url = "http://domain1.com/1001-1/1001-1-1"; - + // get the nice url for 100111 routingContext = GetRoutingContext(url, 9999, umbracoSettings: settings); Assert.AreEqual("http://domain2.com/1001-1-1/", routingContext.UrlProvider.GetUrl(100111, true)); @@ -44,8 +44,8 @@ namespace Umbraco.Tests.Routing // check that the proper route has been cached var cache = routingContext.UmbracoContext.ContentCache.InnerCache as PublishedContentCache; if (cache == null) throw new Exception("Unsupported IPublishedContentCache, only the Xml one is supported."); - //var cachedRoutes = cache.RoutesCache.GetCachedRoutes(); - //Assert.AreEqual("10011/1001-1-1", cachedRoutes[100111]); + var cachedRoutes = cache.RoutesCache.GetCachedRoutes(); + Assert.AreEqual("10011/1001-1-1", cachedRoutes[100111]); // route a rogue url url = "http://domain1.com/1001-1/1001-1-1"; @@ -61,9 +61,9 @@ namespace Umbraco.Tests.Routing Assert.AreEqual(100111, pcr.PublishedContent.Id); // has the cache been polluted? - //cachedRoutes = cache.RoutesCache.GetCachedRoutes(); - //Assert.AreEqual("10011/1001-1-1", cachedRoutes[100111]); // no - ////Assert.AreEqual("1001/1001-1/1001-1-1", cachedRoutes[100111]); // yes + cachedRoutes = cache.RoutesCache.GetCachedRoutes(); + Assert.AreEqual("10011/1001-1-1", cachedRoutes[100111]); // no + //Assert.AreEqual("1001/1001-1/1001-1-1", cachedRoutes[100111]); // yes // what's the nice url now? Assert.AreEqual("http://domain2.com/1001-1-1/", routingContext.UrlProvider.GetUrl(100111)); // good @@ -89,7 +89,7 @@ namespace Umbraco.Tests.Routing protected override string GetXmlContent(int templateId) { return @" - ]> diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs index d9b0363408..c8ddd77afd 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs @@ -2,11 +2,9 @@ using System; using System.Collections.Generic; using System.Globalization; using System.Runtime.CompilerServices; -using System.Text; using System.Xml; using System.Xml.XPath; using Umbraco.Core.Configuration; -using Umbraco.Core.Logging; using Umbraco.Core; using Umbraco.Core.Models; using Umbraco.Core.Models.PublishedContent; @@ -18,7 +16,6 @@ using umbraco.BusinessLogic; using umbraco.presentation.preview; using Umbraco.Core.Services; using GlobalSettings = umbraco.GlobalSettings; -using Task = System.Threading.Tasks.Task; namespace Umbraco.Web.PublishedCache.XmlPublishedCache { @@ -83,7 +80,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache && DomainHelper.ExistsDomainInPath(umbracoContext.Application.Services.DomainService.GetAll(false), content.Path, domainRootNodeId) == false; if (deepest) - _routesCache.Store(content.Id, route); + _routesCache.Store(content.Id, route, true); // trusted route } public virtual string GetRouteById(UmbracoContext umbracoContext, bool preview, int contentId) @@ -98,9 +95,16 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache // else actually determine the route route = DetermineRouteById(umbracoContext, preview, contentId); - // may be null if node not found - // do NOT cache the route: it may be colliding - and since checking for a collision implies - // doing one DetermineIdByRoute anyways we are not causing any perf penalty by not caching + // node not found + if (route == null) + return null; + + // cache the route BUT do NOT trust it as it can be a colliding route + // meaning if we GetRouteById again, we'll get it from cache, but it + // won't be used for inbound routing + if (preview == false) + _routesCache.Store(contentId, route, false); + return route; } diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/RoutesCache.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/RoutesCache.cs index 9c8eed322b..4e775b3253 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/RoutesCache.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/RoutesCache.cs @@ -83,10 +83,12 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache /// /// The node identified. /// The route. - public void Store(int nodeId, string route) + /// A value indicating whether the value can be trusted for inbound routing. + public void Store(int nodeId, string route, bool trust) { _routes.AddOrUpdate(nodeId, i => route, (i, s) => route); - _nodeIds.AddOrUpdate(route, i => nodeId, (i, s) => nodeId); + if (trust) + _nodeIds.AddOrUpdate(route, i => nodeId, (i, s) => nodeId); } /// @@ -119,15 +121,12 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache /// The node identifier. public void ClearNode(int nodeId) { - if (!_routes.ContainsKey(nodeId)) return; - - string key; - if (!_routes.TryGetValue(nodeId, out key)) return; - - int val; - _nodeIds.TryRemove(key, out val); - string val2; - _routes.TryRemove(nodeId, out val2); + string route; + if (_routes.TryRemove(nodeId, out route)) + { + int id; + _nodeIds.TryRemove(route, out id); + } } /// From cfd8435d684a3f3e8f5841feb327245cefb537fe Mon Sep 17 00:00:00 2001 From: Stephan Date: Mon, 9 Jan 2017 17:49:12 +0100 Subject: [PATCH 20/39] deploy-150 - wire GetSize in services --- src/Umbraco.Core/IO/FileSystemExtensions.cs | 7 ++- .../Repositories/FileRepository.cs | 29 ++++++++--- .../Interfaces/IPartialViewRepository.cs | 1 + .../Interfaces/IScriptRepository.cs | 1 + .../Interfaces/IStylesheetRepository.cs | 1 + .../Interfaces/ITemplateRepository.cs | 2 + .../Interfaces/IXsltFileRepository.cs | 1 + .../Repositories/StylesheetRepository.cs | 14 ++++++ .../Repositories/TemplateRepository.cs | 5 ++ src/Umbraco.Core/Services/FileService.cs | 48 +++++++++++++++++++ src/Umbraco.Core/Services/IFileService.cs | 42 ++++++++++++++++ src/Umbraco.Core/Services/IMediaService.cs | 7 +++ src/Umbraco.Core/Services/MediaService.cs | 5 ++ 13 files changed, 152 insertions(+), 11 deletions(-) diff --git a/src/Umbraco.Core/IO/FileSystemExtensions.cs b/src/Umbraco.Core/IO/FileSystemExtensions.cs index aeb6f9a42a..be09f1e310 100644 --- a/src/Umbraco.Core/IO/FileSystemExtensions.cs +++ b/src/Umbraco.Core/IO/FileSystemExtensions.cs @@ -38,13 +38,12 @@ namespace Umbraco.Core.IO } // GetSize has been added to IFileSystem2 but not IFileSystem - // this is implementing GetSize for IFileSystem, the old way public static long GetSize(this IFileSystem fs, string path) { - // if we reach this point, fs is *not* IFileSystem2 - // so it's not FileSystemWrapper nor shadow nor anything we know - // so... fall back to the old & inefficient method + var fs2 = fs as IFileSystem2; + if (fs2 != null) return fs2.GetSize(path); + // this is implementing GetSize for IFileSystem, the old way using (var file = fs.OpenFile(path)) { return file.Length; diff --git a/src/Umbraco.Core/Persistence/Repositories/FileRepository.cs b/src/Umbraco.Core/Persistence/Repositories/FileRepository.cs index 7ce0d71097..03a8b7e824 100644 --- a/src/Umbraco.Core/Persistence/Repositories/FileRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/FileRepository.cs @@ -234,13 +234,28 @@ namespace Umbraco.Core.Persistence.Repositories } } - /// - /// Dispose any disposable properties - /// - /// - /// Dispose the unit of work - /// - protected override void DisposeResources() + public long GetFileSize(string filename) + { + if (FileSystem.FileExists(filename) == false) + return -1; + + try + { + return FileSystem.GetSize(filename); + } + catch + { + return -1; // deal with race conds + } + } + + /// + /// Dispose any disposable properties + /// + /// + /// Dispose the unit of work + /// + protected override void DisposeResources() { _work.DisposeIfDisposable(); } diff --git a/src/Umbraco.Core/Persistence/Repositories/Interfaces/IPartialViewRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Interfaces/IPartialViewRepository.cs index 7c8391a77a..27342fe643 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Interfaces/IPartialViewRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Interfaces/IPartialViewRepository.cs @@ -10,5 +10,6 @@ namespace Umbraco.Core.Persistence.Repositories bool ValidatePartialView(IPartialView partialView); Stream GetFileContentStream(string filepath); void SetFileContent(string filepath, Stream content); + long GetFileSize(string filepath); } } \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Repositories/Interfaces/IScriptRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Interfaces/IScriptRepository.cs index eacb818faa..c2c0a0ae84 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Interfaces/IScriptRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Interfaces/IScriptRepository.cs @@ -8,5 +8,6 @@ namespace Umbraco.Core.Persistence.Repositories bool ValidateScript(Script script); Stream GetFileContentStream(string filepath); void SetFileContent(string filepath, Stream content); + long GetFileSize(string filepath); } } \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Repositories/Interfaces/IStylesheetRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Interfaces/IStylesheetRepository.cs index 323f11d339..5fadf7b01c 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Interfaces/IStylesheetRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Interfaces/IStylesheetRepository.cs @@ -8,5 +8,6 @@ namespace Umbraco.Core.Persistence.Repositories bool ValidateStylesheet(Stylesheet stylesheet); Stream GetFileContentStream(string filepath); void SetFileContent(string filepath, Stream content); + long GetFileSize(string filepath); } } \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Repositories/Interfaces/ITemplateRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Interfaces/ITemplateRepository.cs index 59845f53f0..fd04e21d75 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Interfaces/ITemplateRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Interfaces/ITemplateRepository.cs @@ -72,5 +72,7 @@ namespace Umbraco.Core.Persistence.Repositories /// The filesystem path to the template. /// The content of the template. void SetFileContent(string filepath, Stream content); + + long GetFileSize(string filepath); } } \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Repositories/Interfaces/IXsltFileRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Interfaces/IXsltFileRepository.cs index 8bff985400..4c56b6eb18 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Interfaces/IXsltFileRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Interfaces/IXsltFileRepository.cs @@ -8,5 +8,6 @@ namespace Umbraco.Core.Persistence.Repositories bool ValidateXsltFile(XsltFile xsltFile); Stream GetFileContentStream(string filepath); void SetFileContent(string filepath, Stream content); + long GetFileSize(string filepath); } } \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Repositories/StylesheetRepository.cs b/src/Umbraco.Core/Persistence/Repositories/StylesheetRepository.cs index 45fff2e43b..7515b8513a 100644 --- a/src/Umbraco.Core/Persistence/Repositories/StylesheetRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/StylesheetRepository.cs @@ -144,6 +144,20 @@ namespace Umbraco.Core.Persistence.Repositories FileSystem.AddFile(filepath, content, true); } + public long GetFileSize(string filepath) + { + if (FileSystem.FileExists(filepath) == false) return -1; + + try + { + return FileSystem.GetSize(filepath); + } + catch + { + return -1; // deal with race conds + } + } + #endregion } } \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Repositories/TemplateRepository.cs b/src/Umbraco.Core/Persistence/Repositories/TemplateRepository.cs index 620ad10e7d..41743601fb 100644 --- a/src/Umbraco.Core/Persistence/Repositories/TemplateRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/TemplateRepository.cs @@ -513,6 +513,11 @@ namespace Umbraco.Core.Persistence.Repositories GetFileSystem(filepath).AddFile(filepath, content, true); } + public long GetFileSize(string filepath) + { + return GetFileSystem(filepath).GetSize(filepath); + } + private IFileSystem GetFileSystem(string filepath) { var ext = Path.GetExtension(filepath); diff --git a/src/Umbraco.Core/Services/FileService.cs b/src/Umbraco.Core/Services/FileService.cs index aa722e0133..6360ad8988 100644 --- a/src/Umbraco.Core/Services/FileService.cs +++ b/src/Umbraco.Core/Services/FileService.cs @@ -569,6 +569,14 @@ namespace Umbraco.Core.Services } } + public long GetTemplateFileSize(string filepath) + { + using (var repository = RepositoryFactory.CreateTemplateRepository(UowProvider.GetUnitOfWork())) + { + return repository.GetFileSize(filepath); + } + } + #endregion public Stream GetStylesheetFileContentStream(string filepath) @@ -587,6 +595,14 @@ namespace Umbraco.Core.Services } } + public long GetStylesheetFileSize(string filepath) + { + using (var repository = RepositoryFactory.CreateStylesheetRepository(UowProvider.GetUnitOfWork())) + { + return repository.GetFileSize(filepath); + } + } + public Stream GetScriptFileContentStream(string filepath) { using (var repository = RepositoryFactory.CreateScriptRepository(UowProvider.GetUnitOfWork())) @@ -603,6 +619,14 @@ namespace Umbraco.Core.Services } } + public long GetScriptFileSize(string filepath) + { + using (var repository = RepositoryFactory.CreateScriptRepository(UowProvider.GetUnitOfWork())) + { + return repository.GetFileSize(filepath); + } + } + public Stream GetXsltFileContentStream(string filepath) { using (var repository = RepositoryFactory.CreateXsltFileRepository(UowProvider.GetUnitOfWork())) @@ -619,6 +643,14 @@ namespace Umbraco.Core.Services } } + public long GetXsltFileSize(string filepath) + { + using (var repository = RepositoryFactory.CreateXsltFileRepository(UowProvider.GetUnitOfWork())) + { + return repository.GetFileSize(filepath); + } + } + #region Partial Views public IEnumerable GetPartialViewSnippetNames(params string[] filterNames) @@ -890,6 +922,14 @@ namespace Umbraco.Core.Services } } + public long GetPartialViewMacroFileSize(string filepath) + { + using (var repository = GetPartialViewRepository(PartialViewType.PartialViewMacro, UowProvider.GetUnitOfWork())) + { + return repository.GetFileSize(filepath); + } + } + public Stream GetPartialViewFileContentStream(string filepath) { using (var repository = GetPartialViewRepository(PartialViewType.PartialView, UowProvider.GetUnitOfWork())) @@ -906,6 +946,14 @@ namespace Umbraco.Core.Services } } + public long GetPartialViewFileSize(string filepath) + { + using (var repository = GetPartialViewRepository(PartialViewType.PartialView, UowProvider.GetUnitOfWork())) + { + return repository.GetFileSize(filepath); + } + } + #endregion private void Audit(AuditType type, string message, int userId, int objectId) diff --git a/src/Umbraco.Core/Services/IFileService.cs b/src/Umbraco.Core/Services/IFileService.cs index 7d266ba64c..5115a25087 100644 --- a/src/Umbraco.Core/Services/IFileService.cs +++ b/src/Umbraco.Core/Services/IFileService.cs @@ -254,6 +254,13 @@ namespace Umbraco.Core.Services /// The content of the template. void SetTemplateFileContent(string filepath, Stream content); + /// + /// Gets the size of a template. + /// + /// The filesystem path to the template. + /// The size of the template. + long GetTemplateFileSize(string filepath); + /// /// Gets the content of a stylesheet as a stream. /// @@ -268,6 +275,13 @@ namespace Umbraco.Core.Services /// The content of the stylesheet. void SetStylesheetFileContent(string filepath, Stream content); + /// + /// Gets the size of a stylesheet. + /// + /// The filesystem path to the stylesheet. + /// The size of the stylesheet. + long GetStylesheetFileSize(string filepath); + /// /// Gets the content of a script file as a stream. /// @@ -282,6 +296,13 @@ namespace Umbraco.Core.Services /// The content of the script file. void SetScriptFileContent(string filepath, Stream content); + /// + /// Gets the size of a script file. + /// + /// The filesystem path to the script file. + /// The size of the script file. + long GetScriptFileSize(string filepath); + /// /// Gets the content of a XSLT file as a stream. /// @@ -296,6 +317,13 @@ namespace Umbraco.Core.Services /// The content of the XSLT file. void SetXsltFileContent(string filepath, Stream content); + /// + /// Gets the size of a XSLT file. + /// + /// The filesystem path to the XSLT file. + /// The size of the XSLT file. + long GetXsltFileSize(string filepath); + /// /// Gets the content of a macro partial view as a stream. /// @@ -310,6 +338,13 @@ namespace Umbraco.Core.Services /// The content of the macro partial view. void SetPartialViewMacroFileContent(string filepath, Stream content); + /// + /// Gets the size of a macro partial view. + /// + /// The filesystem path to the macro partial view. + /// The size of the macro partial view. + long GetPartialViewMacroFileSize(string filepath); + /// /// Gets the content of a partial view as a stream. /// @@ -323,5 +358,12 @@ namespace Umbraco.Core.Services /// The filesystem path to the partial view. /// The content of the partial view. void SetPartialViewFileContent(string filepath, Stream content); + + /// + /// Gets the size of a partial view. + /// + /// The filesystem path to the partial view. + /// The size of the partial view. + long GetPartialViewFileSize(string filepath); } } \ No newline at end of file diff --git a/src/Umbraco.Core/Services/IMediaService.cs b/src/Umbraco.Core/Services/IMediaService.cs index 257ee10d9c..510a1e26ca 100644 --- a/src/Umbraco.Core/Services/IMediaService.cs +++ b/src/Umbraco.Core/Services/IMediaService.cs @@ -430,6 +430,13 @@ namespace Umbraco.Core.Services /// The content of the media. void SetMediaFileContent(string filepath, Stream content); + /// + /// Gets the size of a media. + /// + /// The filesystem path to the media. + /// The size of the media. + long GetMediaFileSize(string filepath); + /// /// Deletes a media file and all thumbnails. /// diff --git a/src/Umbraco.Core/Services/MediaService.cs b/src/Umbraco.Core/Services/MediaService.cs index b7cc002d96..f582ef1eaa 100644 --- a/src/Umbraco.Core/Services/MediaService.cs +++ b/src/Umbraco.Core/Services/MediaService.cs @@ -1361,6 +1361,11 @@ namespace Umbraco.Core.Services _mediaFileSystem.AddFile(filepath, stream, true); } + public long GetMediaFileSize(string filepath) + { + return _mediaFileSystem.GetSize(filepath); + } + public void DeleteMediaFile(string filepath) { _mediaFileSystem.DeleteFile(filepath, true); From 17c9d19ebb7107966097537f33c45fb3c2d748ff Mon Sep 17 00:00:00 2001 From: Stephan Date: Mon, 9 Jan 2017 17:49:12 +0100 Subject: [PATCH 21/39] deploy-150 - wire GetSize in services --- src/Umbraco.Core/IO/FileSystemExtensions.cs | 7 ++- .../Repositories/FileRepository.cs | 29 ++++++++--- .../Interfaces/IPartialViewRepository.cs | 1 + .../Interfaces/IScriptRepository.cs | 1 + .../Interfaces/IStylesheetRepository.cs | 1 + .../Interfaces/ITemplateRepository.cs | 2 + .../Interfaces/IXsltFileRepository.cs | 1 + .../Repositories/StylesheetRepository.cs | 14 ++++++ .../Repositories/TemplateRepository.cs | 5 ++ src/Umbraco.Core/Services/FileService.cs | 48 +++++++++++++++++++ src/Umbraco.Core/Services/IFileService.cs | 42 ++++++++++++++++ src/Umbraco.Core/Services/IMediaService.cs | 7 +++ src/Umbraco.Core/Services/MediaService.cs | 5 ++ 13 files changed, 152 insertions(+), 11 deletions(-) diff --git a/src/Umbraco.Core/IO/FileSystemExtensions.cs b/src/Umbraco.Core/IO/FileSystemExtensions.cs index aeb6f9a42a..be09f1e310 100644 --- a/src/Umbraco.Core/IO/FileSystemExtensions.cs +++ b/src/Umbraco.Core/IO/FileSystemExtensions.cs @@ -38,13 +38,12 @@ namespace Umbraco.Core.IO } // GetSize has been added to IFileSystem2 but not IFileSystem - // this is implementing GetSize for IFileSystem, the old way public static long GetSize(this IFileSystem fs, string path) { - // if we reach this point, fs is *not* IFileSystem2 - // so it's not FileSystemWrapper nor shadow nor anything we know - // so... fall back to the old & inefficient method + var fs2 = fs as IFileSystem2; + if (fs2 != null) return fs2.GetSize(path); + // this is implementing GetSize for IFileSystem, the old way using (var file = fs.OpenFile(path)) { return file.Length; diff --git a/src/Umbraco.Core/Persistence/Repositories/FileRepository.cs b/src/Umbraco.Core/Persistence/Repositories/FileRepository.cs index 7ce0d71097..03a8b7e824 100644 --- a/src/Umbraco.Core/Persistence/Repositories/FileRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/FileRepository.cs @@ -234,13 +234,28 @@ namespace Umbraco.Core.Persistence.Repositories } } - /// - /// Dispose any disposable properties - /// - /// - /// Dispose the unit of work - /// - protected override void DisposeResources() + public long GetFileSize(string filename) + { + if (FileSystem.FileExists(filename) == false) + return -1; + + try + { + return FileSystem.GetSize(filename); + } + catch + { + return -1; // deal with race conds + } + } + + /// + /// Dispose any disposable properties + /// + /// + /// Dispose the unit of work + /// + protected override void DisposeResources() { _work.DisposeIfDisposable(); } diff --git a/src/Umbraco.Core/Persistence/Repositories/Interfaces/IPartialViewRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Interfaces/IPartialViewRepository.cs index 7c8391a77a..27342fe643 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Interfaces/IPartialViewRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Interfaces/IPartialViewRepository.cs @@ -10,5 +10,6 @@ namespace Umbraco.Core.Persistence.Repositories bool ValidatePartialView(IPartialView partialView); Stream GetFileContentStream(string filepath); void SetFileContent(string filepath, Stream content); + long GetFileSize(string filepath); } } \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Repositories/Interfaces/IScriptRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Interfaces/IScriptRepository.cs index eacb818faa..c2c0a0ae84 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Interfaces/IScriptRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Interfaces/IScriptRepository.cs @@ -8,5 +8,6 @@ namespace Umbraco.Core.Persistence.Repositories bool ValidateScript(Script script); Stream GetFileContentStream(string filepath); void SetFileContent(string filepath, Stream content); + long GetFileSize(string filepath); } } \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Repositories/Interfaces/IStylesheetRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Interfaces/IStylesheetRepository.cs index 323f11d339..5fadf7b01c 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Interfaces/IStylesheetRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Interfaces/IStylesheetRepository.cs @@ -8,5 +8,6 @@ namespace Umbraco.Core.Persistence.Repositories bool ValidateStylesheet(Stylesheet stylesheet); Stream GetFileContentStream(string filepath); void SetFileContent(string filepath, Stream content); + long GetFileSize(string filepath); } } \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Repositories/Interfaces/ITemplateRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Interfaces/ITemplateRepository.cs index 59845f53f0..fd04e21d75 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Interfaces/ITemplateRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Interfaces/ITemplateRepository.cs @@ -72,5 +72,7 @@ namespace Umbraco.Core.Persistence.Repositories /// The filesystem path to the template. /// The content of the template. void SetFileContent(string filepath, Stream content); + + long GetFileSize(string filepath); } } \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Repositories/Interfaces/IXsltFileRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Interfaces/IXsltFileRepository.cs index 8bff985400..4c56b6eb18 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Interfaces/IXsltFileRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Interfaces/IXsltFileRepository.cs @@ -8,5 +8,6 @@ namespace Umbraco.Core.Persistence.Repositories bool ValidateXsltFile(XsltFile xsltFile); Stream GetFileContentStream(string filepath); void SetFileContent(string filepath, Stream content); + long GetFileSize(string filepath); } } \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Repositories/StylesheetRepository.cs b/src/Umbraco.Core/Persistence/Repositories/StylesheetRepository.cs index 45fff2e43b..7515b8513a 100644 --- a/src/Umbraco.Core/Persistence/Repositories/StylesheetRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/StylesheetRepository.cs @@ -144,6 +144,20 @@ namespace Umbraco.Core.Persistence.Repositories FileSystem.AddFile(filepath, content, true); } + public long GetFileSize(string filepath) + { + if (FileSystem.FileExists(filepath) == false) return -1; + + try + { + return FileSystem.GetSize(filepath); + } + catch + { + return -1; // deal with race conds + } + } + #endregion } } \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Repositories/TemplateRepository.cs b/src/Umbraco.Core/Persistence/Repositories/TemplateRepository.cs index 620ad10e7d..41743601fb 100644 --- a/src/Umbraco.Core/Persistence/Repositories/TemplateRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/TemplateRepository.cs @@ -513,6 +513,11 @@ namespace Umbraco.Core.Persistence.Repositories GetFileSystem(filepath).AddFile(filepath, content, true); } + public long GetFileSize(string filepath) + { + return GetFileSystem(filepath).GetSize(filepath); + } + private IFileSystem GetFileSystem(string filepath) { var ext = Path.GetExtension(filepath); diff --git a/src/Umbraco.Core/Services/FileService.cs b/src/Umbraco.Core/Services/FileService.cs index aa722e0133..6360ad8988 100644 --- a/src/Umbraco.Core/Services/FileService.cs +++ b/src/Umbraco.Core/Services/FileService.cs @@ -569,6 +569,14 @@ namespace Umbraco.Core.Services } } + public long GetTemplateFileSize(string filepath) + { + using (var repository = RepositoryFactory.CreateTemplateRepository(UowProvider.GetUnitOfWork())) + { + return repository.GetFileSize(filepath); + } + } + #endregion public Stream GetStylesheetFileContentStream(string filepath) @@ -587,6 +595,14 @@ namespace Umbraco.Core.Services } } + public long GetStylesheetFileSize(string filepath) + { + using (var repository = RepositoryFactory.CreateStylesheetRepository(UowProvider.GetUnitOfWork())) + { + return repository.GetFileSize(filepath); + } + } + public Stream GetScriptFileContentStream(string filepath) { using (var repository = RepositoryFactory.CreateScriptRepository(UowProvider.GetUnitOfWork())) @@ -603,6 +619,14 @@ namespace Umbraco.Core.Services } } + public long GetScriptFileSize(string filepath) + { + using (var repository = RepositoryFactory.CreateScriptRepository(UowProvider.GetUnitOfWork())) + { + return repository.GetFileSize(filepath); + } + } + public Stream GetXsltFileContentStream(string filepath) { using (var repository = RepositoryFactory.CreateXsltFileRepository(UowProvider.GetUnitOfWork())) @@ -619,6 +643,14 @@ namespace Umbraco.Core.Services } } + public long GetXsltFileSize(string filepath) + { + using (var repository = RepositoryFactory.CreateXsltFileRepository(UowProvider.GetUnitOfWork())) + { + return repository.GetFileSize(filepath); + } + } + #region Partial Views public IEnumerable GetPartialViewSnippetNames(params string[] filterNames) @@ -890,6 +922,14 @@ namespace Umbraco.Core.Services } } + public long GetPartialViewMacroFileSize(string filepath) + { + using (var repository = GetPartialViewRepository(PartialViewType.PartialViewMacro, UowProvider.GetUnitOfWork())) + { + return repository.GetFileSize(filepath); + } + } + public Stream GetPartialViewFileContentStream(string filepath) { using (var repository = GetPartialViewRepository(PartialViewType.PartialView, UowProvider.GetUnitOfWork())) @@ -906,6 +946,14 @@ namespace Umbraco.Core.Services } } + public long GetPartialViewFileSize(string filepath) + { + using (var repository = GetPartialViewRepository(PartialViewType.PartialView, UowProvider.GetUnitOfWork())) + { + return repository.GetFileSize(filepath); + } + } + #endregion private void Audit(AuditType type, string message, int userId, int objectId) diff --git a/src/Umbraco.Core/Services/IFileService.cs b/src/Umbraco.Core/Services/IFileService.cs index 7d266ba64c..5115a25087 100644 --- a/src/Umbraco.Core/Services/IFileService.cs +++ b/src/Umbraco.Core/Services/IFileService.cs @@ -254,6 +254,13 @@ namespace Umbraco.Core.Services /// The content of the template. void SetTemplateFileContent(string filepath, Stream content); + /// + /// Gets the size of a template. + /// + /// The filesystem path to the template. + /// The size of the template. + long GetTemplateFileSize(string filepath); + /// /// Gets the content of a stylesheet as a stream. /// @@ -268,6 +275,13 @@ namespace Umbraco.Core.Services /// The content of the stylesheet. void SetStylesheetFileContent(string filepath, Stream content); + /// + /// Gets the size of a stylesheet. + /// + /// The filesystem path to the stylesheet. + /// The size of the stylesheet. + long GetStylesheetFileSize(string filepath); + /// /// Gets the content of a script file as a stream. /// @@ -282,6 +296,13 @@ namespace Umbraco.Core.Services /// The content of the script file. void SetScriptFileContent(string filepath, Stream content); + /// + /// Gets the size of a script file. + /// + /// The filesystem path to the script file. + /// The size of the script file. + long GetScriptFileSize(string filepath); + /// /// Gets the content of a XSLT file as a stream. /// @@ -296,6 +317,13 @@ namespace Umbraco.Core.Services /// The content of the XSLT file. void SetXsltFileContent(string filepath, Stream content); + /// + /// Gets the size of a XSLT file. + /// + /// The filesystem path to the XSLT file. + /// The size of the XSLT file. + long GetXsltFileSize(string filepath); + /// /// Gets the content of a macro partial view as a stream. /// @@ -310,6 +338,13 @@ namespace Umbraco.Core.Services /// The content of the macro partial view. void SetPartialViewMacroFileContent(string filepath, Stream content); + /// + /// Gets the size of a macro partial view. + /// + /// The filesystem path to the macro partial view. + /// The size of the macro partial view. + long GetPartialViewMacroFileSize(string filepath); + /// /// Gets the content of a partial view as a stream. /// @@ -323,5 +358,12 @@ namespace Umbraco.Core.Services /// The filesystem path to the partial view. /// The content of the partial view. void SetPartialViewFileContent(string filepath, Stream content); + + /// + /// Gets the size of a partial view. + /// + /// The filesystem path to the partial view. + /// The size of the partial view. + long GetPartialViewFileSize(string filepath); } } \ No newline at end of file diff --git a/src/Umbraco.Core/Services/IMediaService.cs b/src/Umbraco.Core/Services/IMediaService.cs index 257ee10d9c..510a1e26ca 100644 --- a/src/Umbraco.Core/Services/IMediaService.cs +++ b/src/Umbraco.Core/Services/IMediaService.cs @@ -430,6 +430,13 @@ namespace Umbraco.Core.Services /// The content of the media. void SetMediaFileContent(string filepath, Stream content); + /// + /// Gets the size of a media. + /// + /// The filesystem path to the media. + /// The size of the media. + long GetMediaFileSize(string filepath); + /// /// Deletes a media file and all thumbnails. /// diff --git a/src/Umbraco.Core/Services/MediaService.cs b/src/Umbraco.Core/Services/MediaService.cs index b7cc002d96..f582ef1eaa 100644 --- a/src/Umbraco.Core/Services/MediaService.cs +++ b/src/Umbraco.Core/Services/MediaService.cs @@ -1361,6 +1361,11 @@ namespace Umbraco.Core.Services _mediaFileSystem.AddFile(filepath, stream, true); } + public long GetMediaFileSize(string filepath) + { + return _mediaFileSystem.GetSize(filepath); + } + public void DeleteMediaFile(string filepath) { _mediaFileSystem.DeleteFile(filepath, true); From 055ae0d126a023a03027de032ffa5374da0f1867 Mon Sep 17 00:00:00 2001 From: Shannon Date: Tue, 10 Jan 2017 11:36:35 +1100 Subject: [PATCH 22/39] updates latest IP mem leak fixes --- src/Umbraco.Core/Umbraco.Core.csproj | 4 ++-- src/Umbraco.Core/packages.config | 2 +- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 12 +++++++----- src/Umbraco.Web.UI/packages.config | 4 ++-- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 56958ac0e6..17be8e62df 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -49,8 +49,8 @@ ..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll - - ..\packages\ImageProcessor.2.5.0\lib\net45\ImageProcessor.dll + + ..\packages\ImageProcessor.2.5.1\lib\net45\ImageProcessor.dll ..\packages\log4net-mediumtrust.2.0.0\lib\log4net.dll diff --git a/src/Umbraco.Core/packages.config b/src/Umbraco.Core/packages.config index e132059da8..221e4063f6 100644 --- a/src/Umbraco.Core/packages.config +++ b/src/Umbraco.Core/packages.config @@ -2,7 +2,7 @@ - + diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 19bab66cb3..7b2dd06c89 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -135,11 +135,11 @@ False ..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll - - ..\packages\ImageProcessor.2.5.0\lib\net45\ImageProcessor.dll + + ..\packages\ImageProcessor.2.5.1\lib\net45\ImageProcessor.dll - - ..\packages\ImageProcessor.Web.4.7.1\lib\net45\ImageProcessor.Web.dll + + ..\packages\ImageProcessor.Web.4.7.2\lib\net45\ImageProcessor.Web.dll False @@ -654,7 +654,9 @@ - + + Designer + log4net.config diff --git a/src/Umbraco.Web.UI/packages.config b/src/Umbraco.Web.UI/packages.config index b708ff8de0..6919e10f64 100644 --- a/src/Umbraco.Web.UI/packages.config +++ b/src/Umbraco.Web.UI/packages.config @@ -5,8 +5,8 @@ - - + + From d11e787624d1976cb7b3e110091eef6df315e2ba Mon Sep 17 00:00:00 2001 From: Shannon Date: Tue, 10 Jan 2017 11:37:31 +1100 Subject: [PATCH 23/39] updates Nuspec with IP version --- build/NuSpecs/UmbracoCms.Core.nuspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/NuSpecs/UmbracoCms.Core.nuspec b/build/NuSpecs/UmbracoCms.Core.nuspec index ab79494f71..400a85cbe3 100644 --- a/build/NuSpecs/UmbracoCms.Core.nuspec +++ b/build/NuSpecs/UmbracoCms.Core.nuspec @@ -33,8 +33,8 @@ - - + + From 6531d027fc37edb4def4a80e4217c19bd74ab20d Mon Sep 17 00:00:00 2001 From: Shannon Date: Tue, 10 Jan 2017 11:55:36 +1100 Subject: [PATCH 24/39] fixes error with server side validation + data tyep editor --- .../src/views/datatypes/datatype.edit.controller.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/datatypes/datatype.edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/datatypes/datatype.edit.controller.js index d8f8557fa5..02d5a62432 100644 --- a/src/Umbraco.Web.UI.Client/src/views/datatypes/datatype.edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/datatypes/datatype.edit.controller.js @@ -178,8 +178,6 @@ function DataTypeEditController($scope, $routeParams, $location, appState, navig //share state editorState.set($scope.content); - - dataTypeHelper.rebindChangedProperties($scope.content, data); }); } From 358dd7f32b3055269e40c07042c2398a27d6907c Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Tue, 10 Jan 2017 07:30:35 +0100 Subject: [PATCH 25/39] Move ImageProcessor.Web.Config to not be in the .Core NuGet, it's not a dll --- build/NuSpecs/UmbracoCms.Core.nuspec | 1 - build/NuSpecs/UmbracoCms.nuspec | 1 + src/SolutionInfo.cs | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/NuSpecs/UmbracoCms.Core.nuspec b/build/NuSpecs/UmbracoCms.Core.nuspec index 400a85cbe3..219437d5e0 100644 --- a/build/NuSpecs/UmbracoCms.Core.nuspec +++ b/build/NuSpecs/UmbracoCms.Core.nuspec @@ -35,7 +35,6 @@ - diff --git a/build/NuSpecs/UmbracoCms.nuspec b/build/NuSpecs/UmbracoCms.nuspec index b56c8e6205..320f32de2b 100644 --- a/build/NuSpecs/UmbracoCms.nuspec +++ b/build/NuSpecs/UmbracoCms.nuspec @@ -18,6 +18,7 @@ + diff --git a/src/SolutionInfo.cs b/src/SolutionInfo.cs index 3a27c3ddb2..7ed0a29d79 100644 --- a/src/SolutionInfo.cs +++ b/src/SolutionInfo.cs @@ -2,7 +2,7 @@ using System.Resources; [assembly: AssemblyCompany("Umbraco")] -[assembly: AssemblyCopyright("Copyright © Umbraco 2016")] +[assembly: AssemblyCopyright("Copyright © Umbraco 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] From 0a53f7636c803c86a9ee0a2df8ad3437c9c7a1af Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Tue, 10 Jan 2017 15:01:45 +0100 Subject: [PATCH 26/39] remove orange color from discard changes button --- .../src/views/common/notifications/confirmroutechange.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/common/notifications/confirmroutechange.html b/src/Umbraco.Web.UI.Client/src/views/common/notifications/confirmroutechange.html index a772aa0159..6d47084f08 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/notifications/confirmroutechange.html +++ b/src/Umbraco.Web.UI.Client/src/views/common/notifications/confirmroutechange.html @@ -2,6 +2,6 @@

You have unsaved changes

Are you sure you want to navigate away from this page? - you have unsaved changes

- + From f036bc90c3e5abf9f733cf0c4f5ba9a96de2a358 Mon Sep 17 00:00:00 2001 From: Per Ploug Date: Tue, 10 Jan 2017 16:54:46 +0100 Subject: [PATCH 27/39] Fixes failing mapper test --- src/Umbraco.Web/Models/Mapping/TemplateModelMapper.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Web/Models/Mapping/TemplateModelMapper.cs b/src/Umbraco.Web/Models/Mapping/TemplateModelMapper.cs index 0b9b297f44..d673e573a8 100644 --- a/src/Umbraco.Web/Models/Mapping/TemplateModelMapper.cs +++ b/src/Umbraco.Web/Models/Mapping/TemplateModelMapper.cs @@ -10,7 +10,8 @@ namespace Umbraco.Web.Models.Mapping { public override void ConfigureMappings(IConfiguration config, ApplicationContext applicationContext) { - config.CreateMap(); + config.CreateMap() + .ForMember(x => x.Notifications, exp => exp.Ignore()); config.CreateMap() .ForMember(x => x.Key, exp => exp.Ignore()) From d563eb07a229ec1ed4c4738d7af8a9d164869cf3 Mon Sep 17 00:00:00 2001 From: Per Ploug Date: Tue, 10 Jan 2017 16:55:03 +0100 Subject: [PATCH 28/39] Adds .FirstChild(string alias) extension to Model.Content --- src/Umbraco.Web/PublishedContentExtensions.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Umbraco.Web/PublishedContentExtensions.cs b/src/Umbraco.Web/PublishedContentExtensions.cs index 5caa08729a..7972f109f9 100644 --- a/src/Umbraco.Web/PublishedContentExtensions.cs +++ b/src/Umbraco.Web/PublishedContentExtensions.cs @@ -1777,6 +1777,17 @@ namespace Umbraco.Web return content.Children().FirstOrDefault(); } + /// + /// Gets the first child of the content, of a given content type. + /// + /// The content. + /// The content type alias. + /// The first child of content, of the given content type. + public static IPublishedContent FirstChild(this IPublishedContent content, string alias) + { + return content.Children( alias ).FirstOrDefault(); + } + public static IPublishedContent FirstChild(this IPublishedContent content, Func predicate) { return content.Children(predicate).FirstOrDefault(); From 0b7f60c0f8114d0ca41297f83f75e362aada510e Mon Sep 17 00:00:00 2001 From: Per Ploug Date: Tue, 10 Jan 2017 16:55:30 +0100 Subject: [PATCH 29/39] Fixes to issues with query generation Ensures its typed content and children is called as a method --- src/Umbraco.Web/Editors/TemplateQueryController.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web/Editors/TemplateQueryController.cs b/src/Umbraco.Web/Editors/TemplateQueryController.cs index b6e086d7cc..e3c63dd22e 100644 --- a/src/Umbraco.Web/Editors/TemplateQueryController.cs +++ b/src/Umbraco.Web/Editors/TemplateQueryController.cs @@ -103,7 +103,7 @@ namespace Umbraco.Web.Editors { // we did not find the path sb.Clear(); - sb.AppendFormat("Umbraco.Content({0})", model.Source.Id); + sb.AppendFormat("Umbraco.TypedContent({0})", model.Source.Id); pointerNode = targetNode; } } @@ -126,7 +126,7 @@ namespace Umbraco.Web.Editors timer.Start(); contents = pointerNode.Children; timer.Stop(); - sb.Append(".Children"); + sb.Append(".Children()"); } //setup 2 clauses, 1 for returning, 1 for testing From 98279052e6dd2d7e8a18cb9a7e058c2a58b987b3 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Wed, 11 Jan 2017 10:07:43 +0100 Subject: [PATCH 30/39] remove lorem ipsum from the sections dialog --- .../overlays/templatesections/templatesections.controller.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/common/overlays/templatesections/templatesections.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/overlays/templatesections/templatesections.controller.js index cb5da443b6..d8cc93c1b8 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/overlays/templatesections/templatesections.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/overlays/templatesections/templatesections.controller.js @@ -11,10 +11,6 @@ $scope.model.title = "Sections"; } - if(!$scope.model.subtitle) { - $scope.model.subtitle = "Lorem ipsum dolor sit amet, consectetur adipiscing elit."; - } - vm.select = select; function onInit() { From e8e0b105592821ae1cec85a595f136cbe60556ae Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Wed, 11 Jan 2017 14:26:56 +0100 Subject: [PATCH 31/39] fix issue with inserting partials from folders --- .../src/views/templates/edit.controller.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/templates/edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/templates/edit.controller.js index f661b82e7b..e67273850f 100644 --- a/src/Umbraco.Web.UI.Client/src/views/templates/edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/templates/edit.controller.js @@ -188,7 +188,8 @@ case "partial": //crappy hack due to dictionary items not in umbracoNode table - var code = "@Html.Partial(\"" + model.insert.node.name + "\")"; + var nodeNameWithPath = model.insert.node.id.replace(".cshtml", ""); + var code = "@Html.Partial(\"" + nodeNameWithPath + "\")"; insert(code); break; @@ -300,7 +301,8 @@ title: "Insert Partial view", select: function(node){ //crappy hack due to dictionary items not in umbracoNode table - var code = "@Html.Partial(\"" + node.name + "\")"; + var nodeNameWithPath = node.id.replace(".cshtml", ""); + var code = "@Html.Partial(\"" + nodeNameWithPath + "\")"; insert(code); vm.partialItemOverlay.show = false; From 5a2836eb6d4c9dea7e78502f81791873606b5566 Mon Sep 17 00:00:00 2001 From: Shannon Date: Thu, 12 Jan 2017 13:45:17 +1100 Subject: [PATCH 32/39] bumps version --- build/UmbracoVersion.txt | 2 +- src/SolutionInfo.cs | 2 +- src/Umbraco.Core/Configuration/UmbracoVersion.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/UmbracoVersion.txt b/build/UmbracoVersion.txt index 096e4d6b5c..8e0c551771 100644 --- a/build/UmbracoVersion.txt +++ b/build/UmbracoVersion.txt @@ -1,3 +1,3 @@ # Usage: on line 2 put the release version, on line 3 put the version comment (example: beta) 7.6.0 -alpha044 +alpha047 diff --git a/src/SolutionInfo.cs b/src/SolutionInfo.cs index 5e904fab70..ed91c2f67c 100644 --- a/src/SolutionInfo.cs +++ b/src/SolutionInfo.cs @@ -12,4 +12,4 @@ using System.Resources; [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyFileVersion("7.6.0")] -[assembly: AssemblyInformationalVersion("7.6.0-alpha044")] \ No newline at end of file +[assembly: AssemblyInformationalVersion("7.6.0-alpha047")] \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoVersion.cs b/src/Umbraco.Core/Configuration/UmbracoVersion.cs index 03b1827221..963870654e 100644 --- a/src/Umbraco.Core/Configuration/UmbracoVersion.cs +++ b/src/Umbraco.Core/Configuration/UmbracoVersion.cs @@ -24,7 +24,7 @@ namespace Umbraco.Core.Configuration /// Gets the version comment (like beta or RC). ///
/// The version comment. - public static string CurrentComment { get { return "alpha044"; } } + public static string CurrentComment { get { return "alpha047"; } } // Get the version of the umbraco.dll by looking at a class in that dll // Had to do it like this due to medium trust issues, see: http://haacked.com/archive/2010/11/04/assembly-location-and-medium-trust.aspx From 8a11b0f7a81231ef0cf6e24a531682cc890ca59c Mon Sep 17 00:00:00 2001 From: Shannon Date: Thu, 12 Jan 2017 17:33:30 +1100 Subject: [PATCH 33/39] publisizes a constant (moves it to where it should be), publicizes another required class for deploy, bumps version --- build/UmbracoVersion.txt | 2 +- src/SolutionInfo.cs | 2 +- src/Umbraco.Core/ApplicationContext.cs | 2 +- .../Configuration/GlobalSettings.cs | 7 ++-- .../Configuration/UmbracoVersion.cs | 2 +- src/Umbraco.Core/Constants-System.cs | 3 ++ src/Umbraco.Core/CoreBootManager.cs | 2 +- src/Umbraco.Core/DatabaseContext.cs | 32 +++++++++---------- src/Umbraco.Core/Events/MigrationEventArgs.cs | 10 +++--- src/Umbraco.Core/Models/UmbracoObjectTypes.cs | 8 ++++- .../Migrations/Initial/BaseDataCreation.cs | 2 +- .../Initial/DatabaseSchemaCreation.cs | 6 ++-- .../Initial/DatabaseSchemaResult.cs | 2 +- .../RemoveUmbracoAppConstraints.cs | 2 +- .../AddPreviewXmlTable.cs | 2 +- .../AddIndexToCmsMacroPropertyTable.cs | 2 +- .../AddIndexToCmsMacroTable.cs | 2 +- .../AddPropertyEditorAliasColumn.cs | 2 +- .../AlterCmsMacroPropertyTable.cs | 2 +- .../AlterTagRelationsTable.cs | 2 +- .../TargetVersionSeven/AlterTagsTable.cs | 2 +- .../TargetVersionSeven/AlterUserTable.cs | 2 +- .../AssignMissingKeysAndIndexes.cs | 2 +- .../TargetVersionSeven/DropControlIdColumn.cs | 2 +- .../RemoveCmsMacroPropertyTypeTable.cs | 2 +- .../UpdateControlIdToPropertyEditorAlias.cs | 2 +- .../UpdateRelatedLinksData.cs | 2 +- .../AddLockObjects.cs | 2 +- .../AddLockTable.cs | 2 +- .../UpdateAllowedMediaTypesAtRoot.cs | 2 +- .../AddRedirectUrlTable.cs | 2 +- .../EnsureServersLockObject.cs | 2 +- .../RemoveStylesheetDataAndTablesAgain.cs | 2 +- .../UpdateUniqueIndexOnCmsPropertyData.cs | 2 +- .../AddDataDecimalColumn.cs | 2 +- .../AddUmbracoDeployTables.cs | 2 +- .../AddUniqueIdPropertyTypeGroupColumn.cs | 2 +- ...EnsureContentTypeUniqueIdsAreConsistent.cs | 2 +- .../FixListViewMediaSortOrder.cs | 2 +- .../RemoveParentIdPropertyTypeGroupColumn.cs | 2 +- .../AssignMissingPrimaryForMySqlKeys.cs | 2 +- .../AddMacroUniqueIdColumn.cs | 2 +- .../AddRelationTypeUniqueIdColumn.cs | 2 +- .../RemovePropertyDataIdIndex.cs | 2 +- .../RemoveUmbracoDeployTables.cs | 2 +- .../UpdateUserLanguagesToIsoCode.cs | 2 +- .../EnsureMigrationsTableIdentityIsCorrect.cs | 2 +- .../AddExternalLoginsTable.cs | 2 +- ...reignKeysForLanguageAndDictionaryTables.cs | 2 +- .../AddMigrationTable.cs | 2 +- .../AddPublicAccessTables.cs | 2 +- .../AddRelationTypeForDocumentOnDelete.cs | 2 +- .../AddServerRegistrationColumnsAndLock.cs | 2 +- .../AddUniqueIdPropertyTypeColumn.cs | 2 +- .../AddUserColumns.cs | 2 +- .../CleanUpCorruptedPublishedFlags.cs | 2 +- .../CreateCacheInstructionTable.cs | 2 +- .../MigrateAndRemoveTemplateMasterColumn.cs | 2 +- .../MigrateStylesheetDataToFile.cs | 2 +- .../MovePublicAccessXmlDataToDb.cs | 2 +- .../RemoveHelpTextColumn.cs | 2 +- .../RemoveLanguageLocaleColumn.cs | 2 +- .../RemoveStylesheetDataAndTables.cs | 2 +- .../RemoveUmbracoLoginsTable.cs | 2 +- .../UpdateUniqueIdToHaveCorrectIndexType.cs | 2 +- .../AddIndexToUmbracoNodeTable.cs | 2 +- .../AddMissingForeignKeyForContentType.cs | 2 +- .../AlterDataTypePreValueTable.cs | 2 +- .../RemoveCmsDocumentAliasColumn.cs | 2 +- .../TargetVersionSix/DeleteAppTables.cs | 2 +- .../EnsureAppsTreesUpdated.cs | 2 +- .../MoveMasterContentTypeData.cs | 2 +- .../NewCmsContentType2ContentTypeTable.cs | 2 +- .../RemoveMasterContentTypeColumn.cs | 2 +- .../TargetVersionSix/RenameCmsTabTable.cs | 2 +- .../TargetVersionSix/RenameTabIdColumn.cs | 2 +- ...teCmsContentTypeAllowedContentTypeTable.cs | 2 +- .../UpdateCmsContentTypeTable.cs | 2 +- .../UpdateCmsContentVersionTable.cs | 2 +- .../UpdateCmsPropertyTypeGroupTable.cs | 2 +- .../CreateServerRegistryTable.cs | 2 +- .../AddChangeDocumentTypePermission.cs | 4 +-- .../AdditionalIndexesAndKeys.cs | 4 +-- .../AssignMissingPrimaryForMySqlKeys.cs | 4 +-- .../AssignMissingPrimaryForMySqlKeys2.cs | 2 +- .../ChangePasswordColumn.cs | 4 +-- .../UpdateToNewMemberPropertyAliases.cs | 4 +-- .../UpdatePropertyTypesAndGroups.cs | 2 +- .../UnitOfWork/PetaPocoUnitOfWorkProvider.cs | 4 +-- .../Security/MembershipProviderBase.cs | 3 +- .../Migrations/MigrationIssuesTests.cs | 4 +-- .../TargetVersionSixthMigrationsTest.cs | 2 +- .../Migrations/Upgrades/BaseUpgradeTest.cs | 2 +- .../Upgrades/SqlCeDataUpgradeTest.cs | 2 +- .../Migrations/Upgrades/SqlCeUpgradeTest.cs | 2 +- .../Upgrades/ValidateOlderSchemaTest.cs | 2 +- .../Persistence/BaseTableByTableTest.cs | 2 +- .../Persistence/DatabaseContextTests.cs | 4 +-- .../Services/ThreadSafetyServiceTest.cs | 2 +- .../TestHelpers/BaseDatabaseFactoryTest.cs | 4 +-- .../TestHelpers/BaseUmbracoApplicationTest.cs | 2 +- src/Umbraco.Tests/TestHelpers/TestHelper.cs | 4 +-- src/Umbraco.Web/Install/InstallHelper.cs | 2 +- .../InstallSteps/DatabaseConfigureStep.cs | 2 +- .../InstallSteps/DatabaseInstallStep.cs | 6 ++-- .../InstallSteps/DatabaseUpgradeStep.cs | 2 +- .../Install/InstallSteps/NewInstallStep.cs | 2 +- .../ContentEditing/UmbracoEntityTypes.cs | 7 +++- .../ClearCsrfCookiesAfterUpgrade.cs | 3 +- ...ediaXmlCacheForDeletedItemsAfterUpgrade.cs | 2 +- .../EnsureListViewDataTypeIsCreated.cs | 2 +- .../OverwriteStylesheetFilesFromTempFiles.cs | 2 +- .../PublishAfterUpgradeToVersionSixth.cs | 2 +- .../RebuildXmlCachesAfterUpgrade.cs | 2 +- src/umbraco.businesslogic/Application.cs | 2 +- src/umbraco.businesslogic/GlobalSettings.cs | 4 +-- .../datatype/DataEditorSettingsStorage.cs | 3 +- src/umbraco.datalayer/DataLayerHelper.cs | 3 +- 118 files changed, 170 insertions(+), 155 deletions(-) diff --git a/build/UmbracoVersion.txt b/build/UmbracoVersion.txt index 8e0c551771..1672ad53d0 100644 --- a/build/UmbracoVersion.txt +++ b/build/UmbracoVersion.txt @@ -1,3 +1,3 @@ # Usage: on line 2 put the release version, on line 3 put the version comment (example: beta) 7.6.0 -alpha047 +alpha048 diff --git a/src/SolutionInfo.cs b/src/SolutionInfo.cs index ed91c2f67c..b092457e25 100644 --- a/src/SolutionInfo.cs +++ b/src/SolutionInfo.cs @@ -12,4 +12,4 @@ using System.Resources; [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyFileVersion("7.6.0")] -[assembly: AssemblyInformationalVersion("7.6.0-alpha047")] \ No newline at end of file +[assembly: AssemblyInformationalVersion("7.6.0-alpha048")] \ No newline at end of file diff --git a/src/Umbraco.Core/ApplicationContext.cs b/src/Umbraco.Core/ApplicationContext.cs index e47ef04650..e5bac73edb 100644 --- a/src/Umbraco.Core/ApplicationContext.cs +++ b/src/Umbraco.Core/ApplicationContext.cs @@ -296,7 +296,7 @@ namespace Umbraco.Core // if we have a db context available, if we don't then we are not installed anyways if (DatabaseContext.IsDatabaseConfigured && DatabaseContext.CanConnect) { - var found = Services.MigrationEntryService.FindEntry(GlobalSettings.UmbracoMigrationName, UmbracoVersion.GetSemanticVersion()); + var found = Services.MigrationEntryService.FindEntry(Constants.System.UmbracoMigrationName, UmbracoVersion.GetSemanticVersion()); if (found == null) { //we haven't executed this migration in this environment, so even though the config versions match, diff --git a/src/Umbraco.Core/Configuration/GlobalSettings.cs b/src/Umbraco.Core/Configuration/GlobalSettings.cs index 525bff2999..c28f398333 100644 --- a/src/Umbraco.Core/Configuration/GlobalSettings.cs +++ b/src/Umbraco.Core/Configuration/GlobalSettings.cs @@ -212,7 +212,7 @@ namespace Umbraco.Core.Configuration { get { - var settings = ConfigurationManager.ConnectionStrings[UmbracoConnectionName]; + var settings = ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName]; var connectionString = string.Empty; if (settings != null) @@ -241,10 +241,7 @@ namespace Umbraco.Core.Configuration } } } - - //TODO: Move these to constants! - public const string UmbracoConnectionName = "umbracoDbDSN"; - public const string UmbracoMigrationName = "Umbraco"; + /// /// Gets or sets the configuration status. This will return the version number of the currently installed umbraco instance. diff --git a/src/Umbraco.Core/Configuration/UmbracoVersion.cs b/src/Umbraco.Core/Configuration/UmbracoVersion.cs index 963870654e..cd759cba82 100644 --- a/src/Umbraco.Core/Configuration/UmbracoVersion.cs +++ b/src/Umbraco.Core/Configuration/UmbracoVersion.cs @@ -24,7 +24,7 @@ namespace Umbraco.Core.Configuration /// Gets the version comment (like beta or RC). /// /// The version comment. - public static string CurrentComment { get { return "alpha047"; } } + public static string CurrentComment { get { return "alpha048"; } } // Get the version of the umbraco.dll by looking at a class in that dll // Had to do it like this due to medium trust issues, see: http://haacked.com/archive/2010/11/04/assembly-location-and-medium-trust.aspx diff --git a/src/Umbraco.Core/Constants-System.cs b/src/Umbraco.Core/Constants-System.cs index bc86d1717f..d1ac6fbb38 100644 --- a/src/Umbraco.Core/Constants-System.cs +++ b/src/Umbraco.Core/Constants-System.cs @@ -25,6 +25,9 @@ public const int DefaultContentListViewDataTypeId = -95; public const int DefaultMediaListViewDataTypeId = -96; public const int DefaultMembersListViewDataTypeId = -97; + + public const string UmbracoConnectionName = "umbracoDbDSN"; + public const string UmbracoMigrationName = "Umbraco"; } public static class DatabaseProviders diff --git a/src/Umbraco.Core/CoreBootManager.cs b/src/Umbraco.Core/CoreBootManager.cs index 4ef08bd02f..e98cd31dbf 100644 --- a/src/Umbraco.Core/CoreBootManager.cs +++ b/src/Umbraco.Core/CoreBootManager.cs @@ -105,7 +105,7 @@ namespace Umbraco.Core LegacyParameterEditorAliasConverter.CreateMappingsForCoreEditors(); //create database and service contexts for the app context - var dbFactory = new DefaultDatabaseFactory(GlobalSettings.UmbracoConnectionName, ProfilingLogger.Logger); + var dbFactory = new DefaultDatabaseFactory(Constants.System.UmbracoConnectionName, ProfilingLogger.Logger); Database.Mapper = new PetaPocoMapper(); var dbContext = new DatabaseContext( diff --git a/src/Umbraco.Core/DatabaseContext.cs b/src/Umbraco.Core/DatabaseContext.cs index 2464e1ba7b..483e124e35 100644 --- a/src/Umbraco.Core/DatabaseContext.cs +++ b/src/Umbraco.Core/DatabaseContext.cs @@ -195,14 +195,14 @@ namespace Umbraco.Core return _providerName; _providerName = Constants.DatabaseProviders.SqlServer; - if (ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName] != null) + if (ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName] != null) { - if (string.IsNullOrEmpty(ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName].ProviderName) == false) - _providerName = ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName].ProviderName; + if (string.IsNullOrEmpty(ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName].ProviderName) == false) + _providerName = ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName].ProviderName; } else { - throw new InvalidOperationException("Can't find a connection string with the name '" + GlobalSettings.UmbracoConnectionName + "'"); + throw new InvalidOperationException("Can't find a connection string with the name '" + Constants.System.UmbracoConnectionName + "'"); } return _providerName; } @@ -388,9 +388,9 @@ namespace Umbraco.Core { //Set the connection string for the new datalayer var connectionStringSettings = string.IsNullOrEmpty(providerName) - ? new ConnectionStringSettings(GlobalSettings.UmbracoConnectionName, + ? new ConnectionStringSettings(Constants.System.UmbracoConnectionName, connectionString) - : new ConnectionStringSettings(GlobalSettings.UmbracoConnectionName, + : new ConnectionStringSettings(Constants.System.UmbracoConnectionName, connectionString, providerName); _connectionString = connectionString; @@ -401,10 +401,10 @@ namespace Umbraco.Core var connectionstrings = xml.Root.DescendantsAndSelf("connectionStrings").Single(); // Update connectionString if it exists, or else create a new appSetting for the given key and value - var setting = connectionstrings.Descendants("add").FirstOrDefault(s => s.Attribute("name").Value == GlobalSettings.UmbracoConnectionName); + var setting = connectionstrings.Descendants("add").FirstOrDefault(s => s.Attribute("name").Value == Constants.System.UmbracoConnectionName); if (setting == null) connectionstrings.Add(new XElement("add", - new XAttribute("name", GlobalSettings.UmbracoConnectionName), + new XAttribute("name", Constants.System.UmbracoConnectionName), new XAttribute("connectionString", connectionStringSettings), new XAttribute("providerName", providerName))); else @@ -429,23 +429,23 @@ namespace Umbraco.Core /// internal void Initialize() { - var databaseSettings = ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName]; + var databaseSettings = ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName]; if (databaseSettings != null && string.IsNullOrWhiteSpace(databaseSettings.ConnectionString) == false && string.IsNullOrWhiteSpace(databaseSettings.ProviderName) == false) { var providerName = Constants.DatabaseProviders.SqlServer; string connString = null; - if (!string.IsNullOrEmpty(ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName].ProviderName)) + if (!string.IsNullOrEmpty(ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName].ProviderName)) { - providerName = ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName].ProviderName; - connString = ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName].ConnectionString; + providerName = ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName].ProviderName; + connString = ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName].ConnectionString; } Initialize(providerName, connString); } - else if (ConfigurationManager.AppSettings.ContainsKey(GlobalSettings.UmbracoConnectionName) && string.IsNullOrEmpty(ConfigurationManager.AppSettings[GlobalSettings.UmbracoConnectionName]) == false) + else if (ConfigurationManager.AppSettings.ContainsKey(Constants.System.UmbracoConnectionName) && string.IsNullOrEmpty(ConfigurationManager.AppSettings[Constants.System.UmbracoConnectionName]) == false) { //A valid connectionstring does not exist, but the legacy appSettings key was found, so we'll reconfigure the conn.string. - var legacyConnString = ConfigurationManager.AppSettings[GlobalSettings.UmbracoConnectionName]; + var legacyConnString = ConfigurationManager.AppSettings[Constants.System.UmbracoConnectionName]; if (legacyConnString.ToLowerInvariant().Contains("sqlce4umbraco")) { ConfigureEmbeddedDatabaseConnection(); @@ -476,7 +476,7 @@ namespace Umbraco.Core } //Remove the legacy connection string, so we don't end up in a loop if something goes wrong. - GlobalSettings.RemoveSetting(GlobalSettings.UmbracoConnectionName); + GlobalSettings.RemoveSetting(Constants.System.UmbracoConnectionName); } else @@ -672,7 +672,7 @@ namespace Umbraco.Core //DO the upgrade! - var runner = new MigrationRunner(migrationEntryService, _logger, currentInstalledVersion, UmbracoVersion.GetSemanticVersion(), GlobalSettings.UmbracoMigrationName); + var runner = new MigrationRunner(migrationEntryService, _logger, currentInstalledVersion, UmbracoVersion.GetSemanticVersion(), Constants.System.UmbracoMigrationName); var upgraded = runner.Execute(database, true); diff --git a/src/Umbraco.Core/Events/MigrationEventArgs.cs b/src/Umbraco.Core/Events/MigrationEventArgs.cs index 89dfe56294..6afe9bd754 100644 --- a/src/Umbraco.Core/Events/MigrationEventArgs.cs +++ b/src/Umbraco.Core/Events/MigrationEventArgs.cs @@ -31,13 +31,13 @@ namespace Umbraco.Core.Events [Obsolete("Use constructor accepting a product name instead.")] [EditorBrowsable(EditorBrowsableState.Never)] public MigrationEventArgs(IList eventObject, SemVersion configuredVersion, SemVersion targetVersion, bool canCancel) - : this(eventObject, null, configuredVersion, targetVersion, GlobalSettings.UmbracoMigrationName, canCancel) + : this(eventObject, null, configuredVersion, targetVersion, Constants.System.UmbracoMigrationName, canCancel) { } [Obsolete("Use constructor accepting SemVersion instances and a product name instead.")] [EditorBrowsable(EditorBrowsableState.Never)] public MigrationEventArgs(IList eventObject, Version configuredVersion, Version targetVersion, bool canCancel) - : this(eventObject, null, new SemVersion(configuredVersion), new SemVersion(targetVersion), GlobalSettings.UmbracoMigrationName, canCancel) + : this(eventObject, null, new SemVersion(configuredVersion), new SemVersion(targetVersion), Constants.System.UmbracoMigrationName, canCancel) { } /// @@ -74,7 +74,7 @@ namespace Umbraco.Core.Events MigrationContext = migrationContext; ConfiguredSemVersion = configuredVersion; TargetSemVersion = targetVersion; - ProductName = GlobalSettings.UmbracoMigrationName; + ProductName = Constants.System.UmbracoMigrationName; } /// @@ -97,13 +97,13 @@ namespace Umbraco.Core.Events [Obsolete("Use constructor accepting a product name instead.")] [EditorBrowsable(EditorBrowsableState.Never)] public MigrationEventArgs(IList eventObject, SemVersion configuredVersion, SemVersion targetVersion) - : this(eventObject, null, configuredVersion, targetVersion, GlobalSettings.UmbracoMigrationName, false) + : this(eventObject, null, configuredVersion, targetVersion, Constants.System.UmbracoMigrationName, false) { } [Obsolete("Use constructor accepting SemVersion instances and a product name instead.")] [EditorBrowsable(EditorBrowsableState.Never)] public MigrationEventArgs(IList eventObject, Version configuredVersion, Version targetVersion) - : this(eventObject, null, new SemVersion(configuredVersion), new SemVersion(targetVersion), GlobalSettings.UmbracoMigrationName, false) + : this(eventObject, null, new SemVersion(configuredVersion), new SemVersion(targetVersion), Constants.System.UmbracoMigrationName, false) { } /// diff --git a/src/Umbraco.Core/Models/UmbracoObjectTypes.cs b/src/Umbraco.Core/Models/UmbracoObjectTypes.cs index 3909af2a55..02dc44c4ce 100644 --- a/src/Umbraco.Core/Models/UmbracoObjectTypes.cs +++ b/src/Umbraco.Core/Models/UmbracoObjectTypes.cs @@ -1,4 +1,6 @@ -using Umbraco.Core.CodeAnnotations; +using System; +using System.ComponentModel; +using Umbraco.Core.CodeAnnotations; namespace Umbraco.Core.Models { @@ -17,6 +19,8 @@ namespace Umbraco.Core.Models /// [UmbracoObjectType(Constants.ObjectTypes.ContentItemType)] [FriendlyName("Content Item Type")] + [Obsolete("This is not used and will be removed in future versions")] + [EditorBrowsable(EditorBrowsableState.Never)] ContentItemType, /// @@ -67,6 +71,8 @@ namespace Umbraco.Core.Models /// [UmbracoObjectType(Constants.ObjectTypes.ContentItem)] [FriendlyName("Content Item")] + [Obsolete("This is not used and will be removed in future versions")] + [EditorBrowsable(EditorBrowsableState.Never)] ContentItem, /// diff --git a/src/Umbraco.Core/Persistence/Migrations/Initial/BaseDataCreation.cs b/src/Umbraco.Core/Persistence/Migrations/Initial/BaseDataCreation.cs index 9b5d2bc2c8..3c7fc5ed42 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Initial/BaseDataCreation.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Initial/BaseDataCreation.cs @@ -310,7 +310,7 @@ namespace Umbraco.Core.Persistence.Migrations.Initial var dto = new MigrationDto { Id = 1, - Name = GlobalSettings.UmbracoMigrationName, + Name = Constants.System.UmbracoMigrationName, Version = UmbracoVersion.GetSemanticVersion().ToString(), CreateDate = DateTime.Now }; diff --git a/src/Umbraco.Core/Persistence/Migrations/Initial/DatabaseSchemaCreation.cs b/src/Umbraco.Core/Persistence/Migrations/Initial/DatabaseSchemaCreation.cs index d00e82bf71..83ae1de7e1 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Initial/DatabaseSchemaCreation.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Initial/DatabaseSchemaCreation.cs @@ -12,7 +12,7 @@ namespace Umbraco.Core.Persistence.Migrations.Initial /// /// Represents the initial database schema creation by running CreateTable for all DTOs against the db. /// - internal class DatabaseSchemaCreation + public class DatabaseSchemaCreation { /// /// Constructor @@ -345,7 +345,7 @@ namespace Umbraco.Core.Persistence.Migrations.Initial /// Raises the event. /// /// The instance containing the event data. - protected internal virtual void FireBeforeCreation(DatabaseCreationEventArgs e) + internal virtual void FireBeforeCreation(DatabaseCreationEventArgs e) { if (BeforeCreation != null) { @@ -361,7 +361,7 @@ namespace Umbraco.Core.Persistence.Migrations.Initial /// Raises the event. /// /// The instance containing the event data. - protected virtual void FireAfterCreation(DatabaseCreationEventArgs e) + internal virtual void FireAfterCreation(DatabaseCreationEventArgs e) { if (AfterCreation != null) { diff --git a/src/Umbraco.Core/Persistence/Migrations/Initial/DatabaseSchemaResult.cs b/src/Umbraco.Core/Persistence/Migrations/Initial/DatabaseSchemaResult.cs index 14caeb2a8f..a34db10839 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Initial/DatabaseSchemaResult.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Initial/DatabaseSchemaResult.cs @@ -47,7 +47,7 @@ namespace Umbraco.Core.Persistence.Migrations.Initial if (ValidTables.Any(x => x.InvariantEquals("umbracoMigration"))) { - var allMigrations = migrationEntryService.GetAll(GlobalSettings.UmbracoMigrationName); + var allMigrations = migrationEntryService.GetAll(Constants.System.UmbracoMigrationName); mostrecent = allMigrations.OrderByDescending(x => x.Version).Select(x => x.Version).FirstOrDefault(); } diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionFourNineZero/RemoveUmbracoAppConstraints.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionFourNineZero/RemoveUmbracoAppConstraints.cs index 0f648d34eb..062ec4f22b 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionFourNineZero/RemoveUmbracoAppConstraints.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionFourNineZero/RemoveUmbracoAppConstraints.cs @@ -6,7 +6,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionFourNineZero { - [MigrationAttribute("4.9.0", 0, GlobalSettings.UmbracoMigrationName)] + [MigrationAttribute("4.9.0", 0, Constants.System.UmbracoMigrationName)] public class RemoveUmbracoAppConstraints : MigrationBase { public RemoveUmbracoAppConstraints(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionFourOneZero/AddPreviewXmlTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionFourOneZero/AddPreviewXmlTable.cs index 4e8d3165fb..4ac06d1531 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionFourOneZero/AddPreviewXmlTable.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionFourOneZero/AddPreviewXmlTable.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionFourOneZero { - [Migration("4.1.0", 0, GlobalSettings.UmbracoMigrationName)] + [Migration("4.1.0", 0, Constants.System.UmbracoMigrationName)] public class AddPreviewXmlTable : MigrationBase { public AddPreviewXmlTable(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AddIndexToCmsMacroPropertyTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AddIndexToCmsMacroPropertyTable.cs index b61ac55448..8dfe51f8dc 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AddIndexToCmsMacroPropertyTable.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AddIndexToCmsMacroPropertyTable.cs @@ -10,7 +10,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSeven /// /// Creats a unique index across two columns so we cannot have duplicate property aliases for one macro /// - [Migration("7.0.0", 5, GlobalSettings.UmbracoMigrationName)] + [Migration("7.0.0", 5, Constants.System.UmbracoMigrationName)] public class AddIndexToCmsMacroPropertyTable : MigrationBase { private readonly bool _skipIndexCheck; diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AddIndexToCmsMacroTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AddIndexToCmsMacroTable.cs index d18cb430c0..e6c237d4d6 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AddIndexToCmsMacroTable.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AddIndexToCmsMacroTable.cs @@ -12,7 +12,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSeven /// /// Creates a unique index on the macro alias so we cannot have duplicates by alias /// - [Migration("7.0.0", 4, GlobalSettings.UmbracoMigrationName)] + [Migration("7.0.0", 4, Constants.System.UmbracoMigrationName)] public class AddIndexToCmsMacroTable : MigrationBase { private readonly bool _forTesting; diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AddPropertyEditorAliasColumn.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AddPropertyEditorAliasColumn.cs index e20c2cfb0b..474da442be 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AddPropertyEditorAliasColumn.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AddPropertyEditorAliasColumn.cs @@ -6,7 +6,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSeven { - [Migration("7.0.0", 0, GlobalSettings.UmbracoMigrationName)] + [Migration("7.0.0", 0, Constants.System.UmbracoMigrationName)] public class AddPropertyEditorAliasColumn : MigrationBase { public AddPropertyEditorAliasColumn(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AlterCmsMacroPropertyTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AlterCmsMacroPropertyTable.cs index 9154c6c985..474b8a3c13 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AlterCmsMacroPropertyTable.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AlterCmsMacroPropertyTable.cs @@ -17,7 +17,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSeven /// needs to be changed to editorAlias, we'll do this by removing the constraint,changing the macroPropertyType to the new /// editorAlias column (and maintaing data so we can reference it) /// - [Migration("7.0.0", 6, GlobalSettings.UmbracoMigrationName)] + [Migration("7.0.0", 6, Constants.System.UmbracoMigrationName)] public class AlterCmsMacroPropertyTable : MigrationBase { public AlterCmsMacroPropertyTable(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AlterTagRelationsTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AlterTagRelationsTable.cs index d822b7593a..704fcffc84 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AlterTagRelationsTable.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AlterTagRelationsTable.cs @@ -9,7 +9,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSeven { - [Migration("7.0.0", 8, GlobalSettings.UmbracoMigrationName)] + [Migration("7.0.0", 8, Constants.System.UmbracoMigrationName)] public class AlterTagRelationsTable : MigrationBase { public AlterTagRelationsTable(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AlterTagsTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AlterTagsTable.cs index d069d8222d..32bd9d1403 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AlterTagsTable.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AlterTagsTable.cs @@ -8,7 +8,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSeven { - [Migration("7.0.0", 9, GlobalSettings.UmbracoMigrationName)] + [Migration("7.0.0", 9, Constants.System.UmbracoMigrationName)] public class AlterTagsTable : MigrationBase { public AlterTagsTable(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AlterUserTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AlterUserTable.cs index 28c3eb15f2..d82d73f7c3 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AlterUserTable.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AlterUserTable.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSeven { - [Migration("7.0.0", 3, GlobalSettings.UmbracoMigrationName)] + [Migration("7.0.0", 3, Constants.System.UmbracoMigrationName)] public class AlterUserTable : MigrationBase { public AlterUserTable(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AssignMissingKeysAndIndexes.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AssignMissingKeysAndIndexes.cs index 9de1ea0871..c76031e4e4 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AssignMissingKeysAndIndexes.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AssignMissingKeysAndIndexes.cs @@ -12,7 +12,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSeven /// and it wasn't a MySQL install. /// see: http://issues.umbraco.org/issue/U4-5707 /// - [Migration("7.0.0", 0, GlobalSettings.UmbracoMigrationName)] + [Migration("7.0.0", 0, Constants.System.UmbracoMigrationName)] public class AssignMissingKeysAndIndexes : MigrationBase { public AssignMissingKeysAndIndexes(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/DropControlIdColumn.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/DropControlIdColumn.cs index 0917411f8b..7928255968 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/DropControlIdColumn.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/DropControlIdColumn.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSeven { - [Migration("7.0.0", 2, GlobalSettings.UmbracoMigrationName)] + [Migration("7.0.0", 2, Constants.System.UmbracoMigrationName)] public class DropControlIdColumn : MigrationBase { public DropControlIdColumn(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/RemoveCmsMacroPropertyTypeTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/RemoveCmsMacroPropertyTypeTable.cs index f4f4b9065c..1c83ef5972 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/RemoveCmsMacroPropertyTypeTable.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/RemoveCmsMacroPropertyTypeTable.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSeven { - [Migration("7.0.0", 7, GlobalSettings.UmbracoMigrationName)] + [Migration("7.0.0", 7, Constants.System.UmbracoMigrationName)] public class RemoveCmsMacroPropertyTypeTable : MigrationBase { public RemoveCmsMacroPropertyTypeTable(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/UpdateControlIdToPropertyEditorAlias.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/UpdateControlIdToPropertyEditorAlias.cs index ef464667dd..f94fb7ce2c 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/UpdateControlIdToPropertyEditorAlias.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/UpdateControlIdToPropertyEditorAlias.cs @@ -9,7 +9,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSeven /// /// Updates the data in the changed propertyEditorAlias column after it has been changed by ChangeControlIdColumn /// - [Migration("7.0.0", 1, GlobalSettings.UmbracoMigrationName)] + [Migration("7.0.0", 1, Constants.System.UmbracoMigrationName)] public class UpdateControlIdToPropertyEditorAlias : MigrationBase { public UpdateControlIdToPropertyEditorAlias(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/UpdateRelatedLinksData.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/UpdateRelatedLinksData.cs index 749996ea36..d29935acd2 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/UpdateRelatedLinksData.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/UpdateRelatedLinksData.cs @@ -16,7 +16,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSeven { - [Migration("7.0.0", 10, GlobalSettings.UmbracoMigrationName)] + [Migration("7.0.0", 10, Constants.System.UmbracoMigrationName)] public class UpdateRelatedLinksData : MigrationBase { public UpdateRelatedLinksData(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveFive/AddLockObjects.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveFive/AddLockObjects.cs index c56ae0e2f1..39d139601c 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveFive/AddLockObjects.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveFive/AddLockObjects.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenFiveFive { - [Migration("7.5.5", 101, GlobalSettings.UmbracoMigrationName)] + [Migration("7.5.5", 101, Constants.System.UmbracoMigrationName)] public class AddLockObjects : MigrationBase { public AddLockObjects(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveFive/AddLockTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveFive/AddLockTable.cs index 5dc1720a2a..9774ed62cf 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveFive/AddLockTable.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveFive/AddLockTable.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenFiveFive { - [Migration("7.5.5", 100, GlobalSettings.UmbracoMigrationName)] + [Migration("7.5.5", 100, Constants.System.UmbracoMigrationName)] public class AddLockTable : MigrationBase { public AddLockTable(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveFive/UpdateAllowedMediaTypesAtRoot.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveFive/UpdateAllowedMediaTypesAtRoot.cs index c9a0d509e6..1acb979ff6 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveFive/UpdateAllowedMediaTypesAtRoot.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveFive/UpdateAllowedMediaTypesAtRoot.cs @@ -7,7 +7,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenFiveFiv /// /// See: http://issues.umbraco.org/issue/U4-4196 /// - [Migration("7.5.5", 1, GlobalSettings.UmbracoMigrationName)] + [Migration("7.5.5", 1, Constants.System.UmbracoMigrationName)] public class UpdateAllowedMediaTypesAtRoot : MigrationBase { public UpdateAllowedMediaTypesAtRoot(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveZero/AddRedirectUrlTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveZero/AddRedirectUrlTable.cs index 508c0f284b..829631c7f4 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveZero/AddRedirectUrlTable.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveZero/AddRedirectUrlTable.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenFiveZero { - [Migration("7.5.0", 100, GlobalSettings.UmbracoMigrationName)] + [Migration("7.5.0", 100, Constants.System.UmbracoMigrationName)] public class AddRedirectUrlTable : MigrationBase { public AddRedirectUrlTable(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveZero/EnsureServersLockObject.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveZero/EnsureServersLockObject.cs index 1bfef5ef6d..4c83a70fe2 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveZero/EnsureServersLockObject.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveZero/EnsureServersLockObject.cs @@ -9,7 +9,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenFiveZer // This migration exists for 7.3.0 but it seems like it was not always running properly // if you're upgrading from 7.3.0 or higher than we add this migration, if you're upgrading // from 7.3.0 or lower then you will already get this migration in the migration to get to 7.3.0 - [Migration("7.3.0", "7.5.0", 10, GlobalSettings.UmbracoMigrationName)] + [Migration("7.3.0", "7.5.0", 10, Constants.System.UmbracoMigrationName)] public class EnsureServersLockObject : MigrationBase { public EnsureServersLockObject(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveZero/RemoveStylesheetDataAndTablesAgain.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveZero/RemoveStylesheetDataAndTablesAgain.cs index 96523e25e8..f8c4c14bbe 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveZero/RemoveStylesheetDataAndTablesAgain.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveZero/RemoveStylesheetDataAndTablesAgain.cs @@ -9,7 +9,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenFiveZer /// /// This is here to re-remove these tables, we dropped them in 7.3 but new installs created them again so we're going to re-drop them /// - [Migration("7.5.0", 1, GlobalSettings.UmbracoMigrationName)] + [Migration("7.5.0", 1, Constants.System.UmbracoMigrationName)] public class RemoveStylesheetDataAndTablesAgain : MigrationBase { public RemoveStylesheetDataAndTablesAgain(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveZero/UpdateUniqueIndexOnCmsPropertyData.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveZero/UpdateUniqueIndexOnCmsPropertyData.cs index f8e6abe42e..8ac4d86290 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveZero/UpdateUniqueIndexOnCmsPropertyData.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFiveZero/UpdateUniqueIndexOnCmsPropertyData.cs @@ -12,7 +12,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenFiveZer /// /// See: http://issues.umbraco.org/issue/U4-8522 /// - [Migration("7.5.0", 2, GlobalSettings.UmbracoMigrationName)] + [Migration("7.5.0", 2, Constants.System.UmbracoMigrationName)] public class UpdateUniqueIndexOnCmsPropertyData : MigrationBase { public UpdateUniqueIndexOnCmsPropertyData(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFourZero/AddDataDecimalColumn.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFourZero/AddDataDecimalColumn.cs index 442b92d2b5..26fb006e82 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFourZero/AddDataDecimalColumn.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFourZero/AddDataDecimalColumn.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenFourZero { - [Migration("7.4.0", 1, GlobalSettings.UmbracoMigrationName)] + [Migration("7.4.0", 1, Constants.System.UmbracoMigrationName)] public class AddDataDecimalColumn : MigrationBase { public AddDataDecimalColumn(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFourZero/AddUmbracoDeployTables.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFourZero/AddUmbracoDeployTables.cs index a39cea2ee0..0a1e6058a9 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFourZero/AddUmbracoDeployTables.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFourZero/AddUmbracoDeployTables.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenFourZero { - [Migration("7.4.0", 5, GlobalSettings.UmbracoMigrationName)] + [Migration("7.4.0", 5, Constants.System.UmbracoMigrationName)] public class AddUmbracoDeployTables : MigrationBase { public AddUmbracoDeployTables(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFourZero/AddUniqueIdPropertyTypeGroupColumn.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFourZero/AddUniqueIdPropertyTypeGroupColumn.cs index fe600f6b69..5f987fc966 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFourZero/AddUniqueIdPropertyTypeGroupColumn.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFourZero/AddUniqueIdPropertyTypeGroupColumn.cs @@ -9,7 +9,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenFourZero { - [Migration("7.4.0", 2, GlobalSettings.UmbracoMigrationName)] + [Migration("7.4.0", 2, Constants.System.UmbracoMigrationName)] public class AddUniqueIdPropertyTypeGroupColumn : MigrationBase { public AddUniqueIdPropertyTypeGroupColumn(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFourZero/EnsureContentTypeUniqueIdsAreConsistent.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFourZero/EnsureContentTypeUniqueIdsAreConsistent.cs index 20200a3230..c24048a6a7 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFourZero/EnsureContentTypeUniqueIdsAreConsistent.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFourZero/EnsureContentTypeUniqueIdsAreConsistent.cs @@ -12,7 +12,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenFourZer /// alias, so we need to ensure that these are initially consistent on /// all environments (based on the alias). ///
- [Migration("7.4.0", 3, GlobalSettings.UmbracoMigrationName)] + [Migration("7.4.0", 3, Constants.System.UmbracoMigrationName)] public class EnsureContentTypeUniqueIdsAreConsistent : MigrationBase { public EnsureContentTypeUniqueIdsAreConsistent(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFourZero/FixListViewMediaSortOrder.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFourZero/FixListViewMediaSortOrder.cs index e1fa9e9257..7d5714218a 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFourZero/FixListViewMediaSortOrder.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFourZero/FixListViewMediaSortOrder.cs @@ -6,7 +6,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenFourZero { - [Migration("7.4.0", 4, GlobalSettings.UmbracoMigrationName)] + [Migration("7.4.0", 4, Constants.System.UmbracoMigrationName)] public class FixListViewMediaSortOrder : MigrationBase { public FixListViewMediaSortOrder(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFourZero/RemoveParentIdPropertyTypeGroupColumn.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFourZero/RemoveParentIdPropertyTypeGroupColumn.cs index 3d285c2715..5f4120f243 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFourZero/RemoveParentIdPropertyTypeGroupColumn.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenFourZero/RemoveParentIdPropertyTypeGroupColumn.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenFourZero { - [Migration("7.4.0", 4, GlobalSettings.UmbracoMigrationName)] + [Migration("7.4.0", 4, Constants.System.UmbracoMigrationName)] public class RemoveParentIdPropertyTypeGroupColumn : MigrationBase { public RemoveParentIdPropertyTypeGroupColumn(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenOneZero/AssignMissingPrimaryForMySqlKeys.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenOneZero/AssignMissingPrimaryForMySqlKeys.cs index 6fa0eaa5dc..904a4a9349 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenOneZero/AssignMissingPrimaryForMySqlKeys.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenOneZero/AssignMissingPrimaryForMySqlKeys.cs @@ -11,7 +11,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenOneZero // this is because when the 7.0.0 migrations are executed, this primary key get's created so if this migration is also executed // we will get exceptions because it is trying to create the PK two times. - [Migration("7.0.0", "7.1.0", 0, GlobalSettings.UmbracoMigrationName)] + [Migration("7.0.0", "7.1.0", 0, Constants.System.UmbracoMigrationName)] public class AssignMissingPrimaryForMySqlKeys : MigrationBase { public AssignMissingPrimaryForMySqlKeys(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenSixZero/AddMacroUniqueIdColumn.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenSixZero/AddMacroUniqueIdColumn.cs index c453ee58b2..fee0f37513 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenSixZero/AddMacroUniqueIdColumn.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenSixZero/AddMacroUniqueIdColumn.cs @@ -6,7 +6,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenSixZero { - [Migration("7.6.0", 0, GlobalSettings.UmbracoMigrationName)] + [Migration("7.6.0", 0, Constants.System.UmbracoMigrationName)] public class AddMacroUniqueIdColumn : MigrationBase { public AddMacroUniqueIdColumn(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenSixZero/AddRelationTypeUniqueIdColumn.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenSixZero/AddRelationTypeUniqueIdColumn.cs index 8a6641c523..3fe72bb052 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenSixZero/AddRelationTypeUniqueIdColumn.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenSixZero/AddRelationTypeUniqueIdColumn.cs @@ -6,7 +6,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenSixZero { - [Migration("7.6.0", 0, GlobalSettings.UmbracoMigrationName)] + [Migration("7.6.0", 0, Constants.System.UmbracoMigrationName)] public class AddRelationTypeUniqueIdColumn : MigrationBase { public AddRelationTypeUniqueIdColumn(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenSixZero/RemovePropertyDataIdIndex.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenSixZero/RemovePropertyDataIdIndex.cs index b50c8e5f94..e965e4dd06 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenSixZero/RemovePropertyDataIdIndex.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenSixZero/RemovePropertyDataIdIndex.cs @@ -8,7 +8,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenSixZero /// /// See: http://issues.umbraco.org/issue/U4-9188 /// - [Migration("7.6.0", 0, GlobalSettings.UmbracoMigrationName)] + [Migration("7.6.0", 0, Constants.System.UmbracoMigrationName)] public class UpdateUniqueIndexOnCmsPropertyData : MigrationBase { public UpdateUniqueIndexOnCmsPropertyData(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenSixZero/RemoveUmbracoDeployTables.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenSixZero/RemoveUmbracoDeployTables.cs index ab227ebb01..33bcf5dbcb 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenSixZero/RemoveUmbracoDeployTables.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenSixZero/RemoveUmbracoDeployTables.cs @@ -9,7 +9,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenSixZero { - [Migration("7.6.0", 0, GlobalSettings.UmbracoMigrationName)] + [Migration("7.6.0", 0, Constants.System.UmbracoMigrationName)] public class RemoveUmbracoDeployTables : MigrationBase { public RemoveUmbracoDeployTables(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeOne/UpdateUserLanguagesToIsoCode.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeOne/UpdateUserLanguagesToIsoCode.cs index 50f78ca66d..c3d7857d75 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeOne/UpdateUserLanguagesToIsoCode.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeOne/UpdateUserLanguagesToIsoCode.cs @@ -9,7 +9,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenThreeOn /// /// This fixes the storage of user languages from the old format like en_us to en-US /// - [Migration("7.3.1", 0, GlobalSettings.UmbracoMigrationName)] + [Migration("7.3.1", 0, Constants.System.UmbracoMigrationName)] public class UpdateUserLanguagesToIsoCode : MigrationBase { public UpdateUserLanguagesToIsoCode(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeTwo/EnsureMigrationsTableIdentityIsCorrect.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeTwo/EnsureMigrationsTableIdentityIsCorrect.cs index 91b4bd6438..a52abf1331 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeTwo/EnsureMigrationsTableIdentityIsCorrect.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeTwo/EnsureMigrationsTableIdentityIsCorrect.cs @@ -10,7 +10,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenThreeTw /// This reinserts all migrations in the migrations table to account for initial rows inserted /// on creation without identity enabled. /// - [Migration("7.3.2", 0, GlobalSettings.UmbracoMigrationName)] + [Migration("7.3.2", 0, Constants.System.UmbracoMigrationName)] public class EnsureMigrationsTableIdentityIsCorrect : MigrationBase { public EnsureMigrationsTableIdentityIsCorrect(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/AddExternalLoginsTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/AddExternalLoginsTable.cs index 0fbec244b2..b5bb24e40e 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/AddExternalLoginsTable.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/AddExternalLoginsTable.cs @@ -6,7 +6,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenThreeZero { - [Migration("7.3.0", 9, GlobalSettings.UmbracoMigrationName)] + [Migration("7.3.0", 9, Constants.System.UmbracoMigrationName)] public class AddExternalLoginsTable : MigrationBase { public AddExternalLoginsTable(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/AddForeignKeysForLanguageAndDictionaryTables.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/AddForeignKeysForLanguageAndDictionaryTables.cs index eea56031d4..0baf5bff1a 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/AddForeignKeysForLanguageAndDictionaryTables.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/AddForeignKeysForLanguageAndDictionaryTables.cs @@ -9,7 +9,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenThreeZero { - [Migration("7.3.0", 14, GlobalSettings.UmbracoMigrationName)] + [Migration("7.3.0", 14, Constants.System.UmbracoMigrationName)] public class AddForeignKeysForLanguageAndDictionaryTables : MigrationBase { public AddForeignKeysForLanguageAndDictionaryTables(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/AddMigrationTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/AddMigrationTable.cs index 079dbe1465..856a1d8ff6 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/AddMigrationTable.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/AddMigrationTable.cs @@ -6,7 +6,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenThreeZero { - [Migration("7.3.0", 11, GlobalSettings.UmbracoMigrationName)] + [Migration("7.3.0", 11, Constants.System.UmbracoMigrationName)] public class AddMigrationTable : MigrationBase { public AddMigrationTable(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/AddPublicAccessTables.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/AddPublicAccessTables.cs index 16c0a923ae..b4ec1c20a6 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/AddPublicAccessTables.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/AddPublicAccessTables.cs @@ -6,7 +6,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenThreeZero { - [Migration("7.3.0", 6, GlobalSettings.UmbracoMigrationName)] + [Migration("7.3.0", 6, Constants.System.UmbracoMigrationName)] public class AddPublicAccessTables : MigrationBase { public AddPublicAccessTables(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/AddRelationTypeForDocumentOnDelete.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/AddRelationTypeForDocumentOnDelete.cs index c9db282d85..4865a77ab8 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/AddRelationTypeForDocumentOnDelete.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/AddRelationTypeForDocumentOnDelete.cs @@ -6,7 +6,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenThreeZero { - [Migration("7.3.0", 0, GlobalSettings.UmbracoMigrationName)] + [Migration("7.3.0", 0, Constants.System.UmbracoMigrationName)] public class AddRelationTypeForDocumentOnDelete : MigrationBase { public AddRelationTypeForDocumentOnDelete(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/AddServerRegistrationColumnsAndLock.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/AddServerRegistrationColumnsAndLock.cs index 6a14e408a9..00ab602343 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/AddServerRegistrationColumnsAndLock.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/AddServerRegistrationColumnsAndLock.cs @@ -7,7 +7,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenThreeZero { - [Migration("7.3.0", 17, GlobalSettings.UmbracoMigrationName)] + [Migration("7.3.0", 17, Constants.System.UmbracoMigrationName)] public class AddServerRegistrationColumnsAndLock : MigrationBase { public AddServerRegistrationColumnsAndLock(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/AddUniqueIdPropertyTypeColumn.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/AddUniqueIdPropertyTypeColumn.cs index 7589c7000d..070ef5d512 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/AddUniqueIdPropertyTypeColumn.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/AddUniqueIdPropertyTypeColumn.cs @@ -6,7 +6,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenThreeZero { - [Migration("7.3.0", 13, GlobalSettings.UmbracoMigrationName)] + [Migration("7.3.0", 13, Constants.System.UmbracoMigrationName)] public class AddUniqueIdPropertyTypeColumn : MigrationBase { public AddUniqueIdPropertyTypeColumn(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/AddUserColumns.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/AddUserColumns.cs index 46fde95005..01a3c61791 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/AddUserColumns.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/AddUserColumns.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenThreeZero { - [Migration("7.3.0", 10, GlobalSettings.UmbracoMigrationName)] + [Migration("7.3.0", 10, Constants.System.UmbracoMigrationName)] public class AddUserColumns : MigrationBase { public AddUserColumns(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/CleanUpCorruptedPublishedFlags.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/CleanUpCorruptedPublishedFlags.cs index d62ad7645d..f8dfc0e8bb 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/CleanUpCorruptedPublishedFlags.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/CleanUpCorruptedPublishedFlags.cs @@ -11,7 +11,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenThreeZe /// Older corrupted dbs might have multiple published flags for a content item, this shouldn't be possible /// so we need to clear the content flag on the older version /// - [Migration("7.3.0", 18, GlobalSettings.UmbracoMigrationName)] + [Migration("7.3.0", 18, Constants.System.UmbracoMigrationName)] public class CleanUpCorruptedPublishedFlags : MigrationBase { public CleanUpCorruptedPublishedFlags(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/CreateCacheInstructionTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/CreateCacheInstructionTable.cs index afa5a1e675..d51aceb679 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/CreateCacheInstructionTable.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/CreateCacheInstructionTable.cs @@ -10,7 +10,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenThreeZero { - [Migration("7.3.0", 1, GlobalSettings.UmbracoMigrationName)] + [Migration("7.3.0", 1, Constants.System.UmbracoMigrationName)] public class CreateCacheInstructionTable : MigrationBase { public CreateCacheInstructionTable(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/MigrateAndRemoveTemplateMasterColumn.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/MigrateAndRemoveTemplateMasterColumn.cs index 01db36abd9..59236106ab 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/MigrateAndRemoveTemplateMasterColumn.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/MigrateAndRemoveTemplateMasterColumn.cs @@ -11,7 +11,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenThreeZe /// /// Remove the master column after we've migrated all of the values into the 'ParentId' and Path column of Umbraco node /// - [Migration("7.3.0", 1, GlobalSettings.UmbracoMigrationName)] + [Migration("7.3.0", 1, Constants.System.UmbracoMigrationName)] public class MigrateAndRemoveTemplateMasterColumn : MigrationBase { diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/MigrateStylesheetDataToFile.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/MigrateStylesheetDataToFile.cs index 35e4befc55..40d2a6f183 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/MigrateStylesheetDataToFile.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/MigrateStylesheetDataToFile.cs @@ -20,7 +20,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenThreeZe /// These files will then be copied over once the entire migration is complete so that if any migration fails and the db changes are /// rolled back, the original files won't be affected. /// - [Migration("7.3.0", 2, GlobalSettings.UmbracoMigrationName)] + [Migration("7.3.0", 2, Constants.System.UmbracoMigrationName)] public class MigrateStylesheetDataToFile : MigrationBase { public MigrateStylesheetDataToFile(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/MovePublicAccessXmlDataToDb.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/MovePublicAccessXmlDataToDb.cs index d60385926b..16d1c6fbf5 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/MovePublicAccessXmlDataToDb.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/MovePublicAccessXmlDataToDb.cs @@ -10,7 +10,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenThreeZero { - [Migration("7.3.0", 7, GlobalSettings.UmbracoMigrationName)] + [Migration("7.3.0", 7, Constants.System.UmbracoMigrationName)] public class MovePublicAccessXmlDataToDb : MigrationBase { public MovePublicAccessXmlDataToDb(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/RemoveHelpTextColumn.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/RemoveHelpTextColumn.cs index d4911bd65a..5370ec0de3 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/RemoveHelpTextColumn.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/RemoveHelpTextColumn.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenThreeZero { - [Migration("7.3.0", 8, GlobalSettings.UmbracoMigrationName)] + [Migration("7.3.0", 8, Constants.System.UmbracoMigrationName)] public class RemoveHelpTextColumn : MigrationBase { public RemoveHelpTextColumn(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/RemoveLanguageLocaleColumn.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/RemoveLanguageLocaleColumn.cs index a793cc6bbc..bf57364615 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/RemoveLanguageLocaleColumn.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/RemoveLanguageLocaleColumn.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenThreeZero { - [Migration("7.3.0", 4, GlobalSettings.UmbracoMigrationName)] + [Migration("7.3.0", 4, Constants.System.UmbracoMigrationName)] public class RemoveLanguageLocaleColumn : MigrationBase { public RemoveLanguageLocaleColumn(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/RemoveStylesheetDataAndTables.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/RemoveStylesheetDataAndTables.cs index da6d1b957d..e6b195cbf4 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/RemoveStylesheetDataAndTables.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/RemoveStylesheetDataAndTables.cs @@ -6,7 +6,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenThreeZero { - [Migration("7.3.0", 3, GlobalSettings.UmbracoMigrationName)] + [Migration("7.3.0", 3, Constants.System.UmbracoMigrationName)] public class RemoveStylesheetDataAndTables : MigrationBase { public RemoveStylesheetDataAndTables(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/RemoveUmbracoLoginsTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/RemoveUmbracoLoginsTable.cs index b842ec041a..5fef478cc6 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/RemoveUmbracoLoginsTable.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/RemoveUmbracoLoginsTable.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenThreeZero { - [Migration("7.3.0", 15, GlobalSettings.UmbracoMigrationName)] + [Migration("7.3.0", 15, Constants.System.UmbracoMigrationName)] public class RemoveUmbracoLoginsTable : MigrationBase { public RemoveUmbracoLoginsTable(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/UpdateUniqueIdToHaveCorrectIndexType.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/UpdateUniqueIdToHaveCorrectIndexType.cs index ee6849c1e4..8eeca45cb1 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/UpdateUniqueIdToHaveCorrectIndexType.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/UpdateUniqueIdToHaveCorrectIndexType.cs @@ -6,7 +6,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenThreeZero { - [Migration("7.3.0", 5, GlobalSettings.UmbracoMigrationName)] + [Migration("7.3.0", 5, Constants.System.UmbracoMigrationName)] public class UpdateUniqueIdToHaveCorrectIndexType : MigrationBase { public UpdateUniqueIdToHaveCorrectIndexType(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenTwoZero/AddIndexToUmbracoNodeTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenTwoZero/AddIndexToUmbracoNodeTable.cs index 87c39b5f7e..7d5109a1db 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenTwoZero/AddIndexToUmbracoNodeTable.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenTwoZero/AddIndexToUmbracoNodeTable.cs @@ -6,7 +6,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenTwoZero { - [Migration("7.2.0", 3, GlobalSettings.UmbracoMigrationName)] + [Migration("7.2.0", 3, Constants.System.UmbracoMigrationName)] public class AddIndexToUmbracoNodeTable : MigrationBase { private readonly bool _skipIndexCheck; diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenTwoZero/AddMissingForeignKeyForContentType.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenTwoZero/AddMissingForeignKeyForContentType.cs index 31cb6132cc..47b1f334d3 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenTwoZero/AddMissingForeignKeyForContentType.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenTwoZero/AddMissingForeignKeyForContentType.cs @@ -8,7 +8,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenTwoZero { - [Migration("7.2.0", 1, GlobalSettings.UmbracoMigrationName)] + [Migration("7.2.0", 1, Constants.System.UmbracoMigrationName)] public class AddMissingForeignKeyForContentType : MigrationBase { public AddMissingForeignKeyForContentType(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenTwoZero/AlterDataTypePreValueTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenTwoZero/AlterDataTypePreValueTable.cs index e0d8e1b5dd..ba3938dd18 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenTwoZero/AlterDataTypePreValueTable.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenTwoZero/AlterDataTypePreValueTable.cs @@ -9,7 +9,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenTwoZero { - [Migration("7.2.0", 0, GlobalSettings.UmbracoMigrationName)] + [Migration("7.2.0", 0, Constants.System.UmbracoMigrationName)] public class AlterDataTypePreValueTable : MigrationBase { public AlterDataTypePreValueTable(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenTwoZero/RemoveCmsDocumentAliasColumn.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenTwoZero/RemoveCmsDocumentAliasColumn.cs index 2a8440af64..e67a8e7756 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenTwoZero/RemoveCmsDocumentAliasColumn.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenTwoZero/RemoveCmsDocumentAliasColumn.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenTwoZero { - [Migration("7.2.0", 2, GlobalSettings.UmbracoMigrationName)] + [Migration("7.2.0", 2, Constants.System.UmbracoMigrationName)] public class RemoveCmsDocumentAliasColumn : MigrationBase { public RemoveCmsDocumentAliasColumn(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/DeleteAppTables.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/DeleteAppTables.cs index a5b9bc1415..b4d394bec2 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/DeleteAppTables.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/DeleteAppTables.cs @@ -6,7 +6,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSix { - [Migration("6.0.0", 10, GlobalSettings.UmbracoMigrationName)] + [Migration("6.0.0", 10, Constants.System.UmbracoMigrationName)] public class DeleteAppTables : MigrationBase { public DeleteAppTables(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/EnsureAppsTreesUpdated.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/EnsureAppsTreesUpdated.cs index 219936e0e2..49cedc6dc7 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/EnsureAppsTreesUpdated.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/EnsureAppsTreesUpdated.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSix { - [Migration("6.0.0", 9, GlobalSettings.UmbracoMigrationName)] + [Migration("6.0.0", 9, Constants.System.UmbracoMigrationName)] public class EnsureAppsTreesUpdated : MigrationBase { public EnsureAppsTreesUpdated(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/MoveMasterContentTypeData.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/MoveMasterContentTypeData.cs index 3548d19c33..6e77050fd4 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/MoveMasterContentTypeData.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/MoveMasterContentTypeData.cs @@ -4,7 +4,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSix { - [Migration("6.0.0", 5, GlobalSettings.UmbracoMigrationName)] + [Migration("6.0.0", 5, Constants.System.UmbracoMigrationName)] public class MoveMasterContentTypeData : MigrationBase { public MoveMasterContentTypeData(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/NewCmsContentType2ContentTypeTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/NewCmsContentType2ContentTypeTable.cs index 622cefc44c..ee427bb517 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/NewCmsContentType2ContentTypeTable.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/NewCmsContentType2ContentTypeTable.cs @@ -4,7 +4,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSix { - [Migration("6.0.0", 4, GlobalSettings.UmbracoMigrationName)] + [Migration("6.0.0", 4, Constants.System.UmbracoMigrationName)] public class NewCmsContentType2ContentTypeTable : MigrationBase { public NewCmsContentType2ContentTypeTable(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/RemoveMasterContentTypeColumn.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/RemoveMasterContentTypeColumn.cs index 7042e3c21f..e8964ced28 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/RemoveMasterContentTypeColumn.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/RemoveMasterContentTypeColumn.cs @@ -4,7 +4,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSix { - [Migration("6.0.0", 6, GlobalSettings.UmbracoMigrationName)] + [Migration("6.0.0", 6, Constants.System.UmbracoMigrationName)] public class RemoveMasterContentTypeColumn : MigrationBase { public RemoveMasterContentTypeColumn(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/RenameCmsTabTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/RenameCmsTabTable.cs index 9c97cd3444..c0738383d2 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/RenameCmsTabTable.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/RenameCmsTabTable.cs @@ -4,7 +4,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSix { - [Migration("6.0.0", 0, GlobalSettings.UmbracoMigrationName)] + [Migration("6.0.0", 0, Constants.System.UmbracoMigrationName)] public class RenameCmsTabTable : MigrationBase { public RenameCmsTabTable(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/RenameTabIdColumn.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/RenameTabIdColumn.cs index 14d3049d7e..fff439c03d 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/RenameTabIdColumn.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/RenameTabIdColumn.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSix { - [Migration("6.0.0", 7, GlobalSettings.UmbracoMigrationName)] + [Migration("6.0.0", 7, Constants.System.UmbracoMigrationName)] public class RenameTabIdColumn : MigrationBase { public RenameTabIdColumn(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsContentTypeAllowedContentTypeTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsContentTypeAllowedContentTypeTable.cs index ede56d08e9..11168a69cb 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsContentTypeAllowedContentTypeTable.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsContentTypeAllowedContentTypeTable.cs @@ -4,7 +4,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSix { - [Migration("6.0.0", 3, GlobalSettings.UmbracoMigrationName)] + [Migration("6.0.0", 3, Constants.System.UmbracoMigrationName)] public class UpdateCmsContentTypeAllowedContentTypeTable : MigrationBase { public UpdateCmsContentTypeAllowedContentTypeTable(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsContentTypeTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsContentTypeTable.cs index 0443c7f0bf..eb57f87c95 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsContentTypeTable.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsContentTypeTable.cs @@ -6,7 +6,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSix { - [Migration("6.0.0", 2, GlobalSettings.UmbracoMigrationName)] + [Migration("6.0.0", 2, Constants.System.UmbracoMigrationName)] public class UpdateCmsContentTypeTable : MigrationBase { public UpdateCmsContentTypeTable(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsContentVersionTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsContentVersionTable.cs index f78048fcb1..cee55fee41 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsContentVersionTable.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsContentVersionTable.cs @@ -4,7 +4,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSix { - [Migration("6.0.0", 8, GlobalSettings.UmbracoMigrationName)] + [Migration("6.0.0", 8, Constants.System.UmbracoMigrationName)] public class UpdateCmsContentVersionTable : MigrationBase { public UpdateCmsContentVersionTable(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsPropertyTypeGroupTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsPropertyTypeGroupTable.cs index 4b13c8b51d..7e0244bc57 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsPropertyTypeGroupTable.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsPropertyTypeGroupTable.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSix { - [Migration("6.0.0", 1, GlobalSettings.UmbracoMigrationName)] + [Migration("6.0.0", 1, Constants.System.UmbracoMigrationName)] public class UpdateCmsPropertyTypeGroupTable : MigrationBase { public UpdateCmsPropertyTypeGroupTable(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixOneZero/CreateServerRegistryTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixOneZero/CreateServerRegistryTable.cs index 9037422960..bcd7ac5d6f 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixOneZero/CreateServerRegistryTable.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixOneZero/CreateServerRegistryTable.cs @@ -10,7 +10,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSixOneZero { - [Migration("6.1.0", 0, GlobalSettings.UmbracoMigrationName)] + [Migration("6.1.0", 0, Constants.System.UmbracoMigrationName)] public class CreateServerRegistryTable : MigrationBase { public CreateServerRegistryTable(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AddChangeDocumentTypePermission.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AddChangeDocumentTypePermission.cs index bad80e7c3a..42a652b166 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AddChangeDocumentTypePermission.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AddChangeDocumentTypePermission.cs @@ -6,8 +6,8 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSixTwoZero { - [Migration("7.1.0", 3, GlobalSettings.UmbracoMigrationName)] - [Migration("6.2.0", 3, GlobalSettings.UmbracoMigrationName)] + [Migration("7.1.0", 3, Constants.System.UmbracoMigrationName)] + [Migration("6.2.0", 3, Constants.System.UmbracoMigrationName)] public class AddChangeDocumentTypePermission : MigrationBase { public AddChangeDocumentTypePermission(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AdditionalIndexesAndKeys.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AdditionalIndexesAndKeys.cs index 0938d9be91..64f2970bdf 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AdditionalIndexesAndKeys.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AdditionalIndexesAndKeys.cs @@ -8,8 +8,8 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSixTwoZero { - [Migration("7.1.0", 1, GlobalSettings.UmbracoMigrationName)] - [Migration("6.2.0", 1, GlobalSettings.UmbracoMigrationName)] + [Migration("7.1.0", 1, Constants.System.UmbracoMigrationName)] + [Migration("6.2.0", 1, Constants.System.UmbracoMigrationName)] public class AdditionalIndexesAndKeys : MigrationBase { public AdditionalIndexesAndKeys(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AssignMissingPrimaryForMySqlKeys.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AssignMissingPrimaryForMySqlKeys.cs index d8ecf855eb..5f2d6292c1 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AssignMissingPrimaryForMySqlKeys.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AssignMissingPrimaryForMySqlKeys.cs @@ -8,8 +8,8 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSixTwoZero { //see: http://issues.umbraco.org/issue/U4-4430 - [Migration("7.1.0", 0, GlobalSettings.UmbracoMigrationName)] - [Migration("6.2.0", 0, GlobalSettings.UmbracoMigrationName)] + [Migration("7.1.0", 0, Constants.System.UmbracoMigrationName)] + [Migration("6.2.0", 0, Constants.System.UmbracoMigrationName)] public class AssignMissingPrimaryForMySqlKeys : MigrationBase { public AssignMissingPrimaryForMySqlKeys(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AssignMissingPrimaryForMySqlKeys2.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AssignMissingPrimaryForMySqlKeys2.cs index b41bdea124..da7a5ce609 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AssignMissingPrimaryForMySqlKeys2.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AssignMissingPrimaryForMySqlKeys2.cs @@ -8,7 +8,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSixTwoZero //We have to target this specifically to ensure this DOES NOT execute if upgrading from a version previous to 6.0, // this is because when the 6.0.0 migrations are executed, this primary key get's created so if this migration is also executed // we will get exceptions because it is trying to create the PK two times. - [Migration("6.0.0", "6.2.0", 0, GlobalSettings.UmbracoMigrationName)] + [Migration("6.0.0", "6.2.0", 0, Constants.System.UmbracoMigrationName)] public class AssignMissingPrimaryForMySqlKeys2 : MigrationBase { public AssignMissingPrimaryForMySqlKeys2(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/ChangePasswordColumn.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/ChangePasswordColumn.cs index cad1c0e127..327291f34b 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/ChangePasswordColumn.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/ChangePasswordColumn.cs @@ -5,8 +5,8 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSixTwoZero { - [Migration("7.1.0", 2, GlobalSettings.UmbracoMigrationName)] - [Migration("6.2.0", 2, GlobalSettings.UmbracoMigrationName)] + [Migration("7.1.0", 2, Constants.System.UmbracoMigrationName)] + [Migration("6.2.0", 2, Constants.System.UmbracoMigrationName)] public class ChangePasswordColumn : MigrationBase { public ChangePasswordColumn(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/UpdateToNewMemberPropertyAliases.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/UpdateToNewMemberPropertyAliases.cs index 454d0e18ed..4038bdd1e9 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/UpdateToNewMemberPropertyAliases.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/UpdateToNewMemberPropertyAliases.cs @@ -7,8 +7,8 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSixTwoZero { - [Migration("7.1.0", 4, GlobalSettings.UmbracoMigrationName)] - [Migration("6.2.0", 4, GlobalSettings.UmbracoMigrationName)] + [Migration("7.1.0", 4, Constants.System.UmbracoMigrationName)] + [Migration("6.2.0", 4, Constants.System.UmbracoMigrationName)] public class UpdateToNewMemberPropertyAliases : MigrationBase { public UpdateToNewMemberPropertyAliases(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixZeroOne/UpdatePropertyTypesAndGroups.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixZeroOne/UpdatePropertyTypesAndGroups.cs index 32c81700a8..15817d313d 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixZeroOne/UpdatePropertyTypesAndGroups.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixZeroOne/UpdatePropertyTypesAndGroups.cs @@ -7,7 +7,7 @@ using Umbraco.Core.Persistence.SqlSyntax; namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSixZeroOne { - [Migration("6.0.2", 0, GlobalSettings.UmbracoMigrationName)] + [Migration("6.0.2", 0, Constants.System.UmbracoMigrationName)] public class UpdatePropertyTypesAndGroups : MigrationBase { public UpdatePropertyTypesAndGroups(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) diff --git a/src/Umbraco.Core/Persistence/UnitOfWork/PetaPocoUnitOfWorkProvider.cs b/src/Umbraco.Core/Persistence/UnitOfWork/PetaPocoUnitOfWorkProvider.cs index 8c909fc554..97d066d572 100644 --- a/src/Umbraco.Core/Persistence/UnitOfWork/PetaPocoUnitOfWorkProvider.cs +++ b/src/Umbraco.Core/Persistence/UnitOfWork/PetaPocoUnitOfWorkProvider.cs @@ -13,7 +13,7 @@ namespace Umbraco.Core.Persistence.UnitOfWork [Obsolete("Use the constructor specifying an ILogger instead")] public PetaPocoUnitOfWorkProvider() - : this(new DefaultDatabaseFactory(GlobalSettings.UmbracoConnectionName, LoggerResolver.Current.Logger)) + : this(new DefaultDatabaseFactory(Constants.System.UmbracoConnectionName, LoggerResolver.Current.Logger)) { } @@ -27,7 +27,7 @@ namespace Umbraco.Core.Persistence.UnitOfWork /// Parameterless constructor uses defaults /// public PetaPocoUnitOfWorkProvider(ILogger logger) - : this(new DefaultDatabaseFactory(GlobalSettings.UmbracoConnectionName, logger)) + : this(new DefaultDatabaseFactory(Constants.System.UmbracoConnectionName, logger)) { } diff --git a/src/Umbraco.Core/Security/MembershipProviderBase.cs b/src/Umbraco.Core/Security/MembershipProviderBase.cs index 3e02d6aec2..859d76b9e7 100644 --- a/src/Umbraco.Core/Security/MembershipProviderBase.cs +++ b/src/Umbraco.Core/Security/MembershipProviderBase.cs @@ -76,7 +76,8 @@ namespace Umbraco.Core.Security private bool _requiresQuestionAndAnswer; private bool _requiresUniqueEmail; private string _customHashAlgorithmType ; - internal bool UseLegacyEncoding; + + public bool UseLegacyEncoding { get; private set; } #region Properties diff --git a/src/Umbraco.Tests/Migrations/MigrationIssuesTests.cs b/src/Umbraco.Tests/Migrations/MigrationIssuesTests.cs index 8b51037d14..e2d5e4873d 100644 --- a/src/Umbraco.Tests/Migrations/MigrationIssuesTests.cs +++ b/src/Umbraco.Tests/Migrations/MigrationIssuesTests.cs @@ -115,7 +115,7 @@ namespace Umbraco.Tests.Migrations logger, new SemVersion(7, 4, 0), new SemVersion(7, 5, 0), - GlobalSettings.UmbracoMigrationName, + Constants.System.UmbracoMigrationName, //pass in explicit migrations new DeleteRedirectUrlTable(SqlSyntax, logger), @@ -128,7 +128,7 @@ namespace Umbraco.Tests.Migrations Assert.IsTrue(upgraded); } - [Migration("7.5.0", 99, GlobalSettings.UmbracoMigrationName)] + [Migration("7.5.0", 99, Constants.System.UmbracoMigrationName)] public class DeleteRedirectUrlTable : MigrationBase { public DeleteRedirectUrlTable(ISqlSyntaxProvider sqlSyntax, ILogger logger) diff --git a/src/Umbraco.Tests/Migrations/TargetVersionSixthMigrationsTest.cs b/src/Umbraco.Tests/Migrations/TargetVersionSixthMigrationsTest.cs index 51822c8098..6d01d63c79 100644 --- a/src/Umbraco.Tests/Migrations/TargetVersionSixthMigrationsTest.cs +++ b/src/Umbraco.Tests/Migrations/TargetVersionSixthMigrationsTest.cs @@ -77,7 +77,7 @@ namespace Umbraco.Tests.Migrations var migrationRunner = new MigrationRunner( Mock.Of(), - Logger, configuredVersion, targetVersion, GlobalSettings.UmbracoMigrationName); + Logger, configuredVersion, targetVersion, Constants.System.UmbracoMigrationName); var migrations = migrationRunner.OrderedUpgradeMigrations(foundMigrations).ToList(); diff --git a/src/Umbraco.Tests/Migrations/Upgrades/BaseUpgradeTest.cs b/src/Umbraco.Tests/Migrations/Upgrades/BaseUpgradeTest.cs index 3a3bbe7aa7..0c8f57771f 100644 --- a/src/Umbraco.Tests/Migrations/Upgrades/BaseUpgradeTest.cs +++ b/src/Umbraco.Tests/Migrations/Upgrades/BaseUpgradeTest.cs @@ -63,7 +63,7 @@ namespace Umbraco.Tests.Migrations.Upgrades logger, configuredVersion, targetVersion, - GlobalSettings.UmbracoMigrationName, + Constants.System.UmbracoMigrationName, //pass in explicit migrations new Core.Persistence.Migrations.Upgrades.TargetVersionFourNineZero.RemoveUmbracoAppConstraints(sql, logger), new DeleteAppTables(sql, logger), diff --git a/src/Umbraco.Tests/Migrations/Upgrades/SqlCeDataUpgradeTest.cs b/src/Umbraco.Tests/Migrations/Upgrades/SqlCeDataUpgradeTest.cs index 2ea7a40e57..54b970c033 100644 --- a/src/Umbraco.Tests/Migrations/Upgrades/SqlCeDataUpgradeTest.cs +++ b/src/Umbraco.Tests/Migrations/Upgrades/SqlCeDataUpgradeTest.cs @@ -31,7 +31,7 @@ namespace Umbraco.Tests.Migrations.Upgrades //Setup the MigrationRunner var migrationRunner = new MigrationRunner( Mock.Of(), - Mock.Of(), configuredVersion, targetVersion, GlobalSettings.UmbracoMigrationName); + Mock.Of(), configuredVersion, targetVersion, Constants.System.UmbracoMigrationName); bool upgraded = migrationRunner.Execute(db, provider, true); diff --git a/src/Umbraco.Tests/Migrations/Upgrades/SqlCeUpgradeTest.cs b/src/Umbraco.Tests/Migrations/Upgrades/SqlCeUpgradeTest.cs index f7080b7bc0..bdaf3f4bfd 100644 --- a/src/Umbraco.Tests/Migrations/Upgrades/SqlCeUpgradeTest.cs +++ b/src/Umbraco.Tests/Migrations/Upgrades/SqlCeUpgradeTest.cs @@ -42,7 +42,7 @@ namespace Umbraco.Tests.Migrations.Upgrades //Create the Sql CE database //Get the connectionstring settings from config - var settings = ConfigurationManager.ConnectionStrings[Core.Configuration.GlobalSettings.UmbracoConnectionName]; + var settings = ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName]; using (var engine = new SqlCeEngine(settings.ConnectionString)) { engine.CreateDatabase(); diff --git a/src/Umbraco.Tests/Migrations/Upgrades/ValidateOlderSchemaTest.cs b/src/Umbraco.Tests/Migrations/Upgrades/ValidateOlderSchemaTest.cs index a375eb6850..5f7da6e401 100644 --- a/src/Umbraco.Tests/Migrations/Upgrades/ValidateOlderSchemaTest.cs +++ b/src/Umbraco.Tests/Migrations/Upgrades/ValidateOlderSchemaTest.cs @@ -66,7 +66,7 @@ namespace Umbraco.Tests.Migrations.Upgrades } //Get the connectionstring settings from config - var settings = ConfigurationManager.ConnectionStrings[Core.Configuration.GlobalSettings.UmbracoConnectionName]; + var settings = ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName]; Resolution.Freeze(); diff --git a/src/Umbraco.Tests/Persistence/BaseTableByTableTest.cs b/src/Umbraco.Tests/Persistence/BaseTableByTableTest.cs index 3322507c49..e8c994f1c0 100644 --- a/src/Umbraco.Tests/Persistence/BaseTableByTableTest.cs +++ b/src/Umbraco.Tests/Persistence/BaseTableByTableTest.cs @@ -51,7 +51,7 @@ namespace Umbraco.Tests.Persistence var dbContext = new DatabaseContext( - new DefaultDatabaseFactory(GlobalSettings.UmbracoConnectionName, _logger), + new DefaultDatabaseFactory(Constants.System.UmbracoConnectionName, _logger), _logger, SqlSyntaxProvider, Constants.DatabaseProviders.SqlCe); var repositoryFactory = new RepositoryFactory(cacheHelper, _logger, SqlSyntaxProvider, SettingsForTests.GenerateMockSettings()); diff --git a/src/Umbraco.Tests/Persistence/DatabaseContextTests.cs b/src/Umbraco.Tests/Persistence/DatabaseContextTests.cs index 1b42daa47c..bf0d3a736b 100644 --- a/src/Umbraco.Tests/Persistence/DatabaseContextTests.cs +++ b/src/Umbraco.Tests/Persistence/DatabaseContextTests.cs @@ -27,7 +27,7 @@ namespace Umbraco.Tests.Persistence SafeCallContext.Clear(); _dbContext = new DatabaseContext( - new DefaultDatabaseFactory(Core.Configuration.GlobalSettings.UmbracoConnectionName, Mock.Of()), + new DefaultDatabaseFactory(Constants.System.UmbracoConnectionName, Mock.Of()), Mock.Of(), new SqlCeSyntaxProvider(), Constants.DatabaseProviders.SqlCe); //unfortunately we have to set this up because the PetaPocoExtensions require singleton access @@ -79,7 +79,7 @@ namespace Umbraco.Tests.Persistence } //Get the connectionstring settings from config - var settings = ConfigurationManager.ConnectionStrings[Core.Configuration.GlobalSettings.UmbracoConnectionName]; + var settings = ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName]; //by default the conn string is: Datasource=|DataDirectory|UmbracoPetaPocoTests.sdf;Flush Interval=1; //we'll just replace the sdf file with our custom one: diff --git a/src/Umbraco.Tests/Services/ThreadSafetyServiceTest.cs b/src/Umbraco.Tests/Services/ThreadSafetyServiceTest.cs index 00e744c28b..504dc0d475 100644 --- a/src/Umbraco.Tests/Services/ThreadSafetyServiceTest.cs +++ b/src/Umbraco.Tests/Services/ThreadSafetyServiceTest.cs @@ -233,7 +233,7 @@ namespace Umbraco.Tests.Services { var db = _databases.GetOrAdd( Thread.CurrentThread.ManagedThreadId, - i => new UmbracoDatabase(Umbraco.Core.Configuration.GlobalSettings.UmbracoConnectionName, _logger)); + i => new UmbracoDatabase(Constants.System.UmbracoConnectionName, _logger)); return db; } diff --git a/src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs b/src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs index c34620432f..873cf6ada4 100644 --- a/src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs +++ b/src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs @@ -151,9 +151,9 @@ namespace Umbraco.Tests.TestHelpers var path = TestHelper.CurrentAssemblyDirectory; //Get the connectionstring settings from config - var settings = ConfigurationManager.ConnectionStrings[Core.Configuration.GlobalSettings.UmbracoConnectionName]; + var settings = ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName]; ConfigurationManager.AppSettings.Set( - Core.Configuration.GlobalSettings.UmbracoConnectionName, + Constants.System.UmbracoConnectionName, GetDbConnectionString()); _dbPath = string.Concat(path, "\\UmbracoPetaPocoTests.sdf"); diff --git a/src/Umbraco.Tests/TestHelpers/BaseUmbracoApplicationTest.cs b/src/Umbraco.Tests/TestHelpers/BaseUmbracoApplicationTest.cs index 642bad4a82..e0453557fa 100644 --- a/src/Umbraco.Tests/TestHelpers/BaseUmbracoApplicationTest.cs +++ b/src/Umbraco.Tests/TestHelpers/BaseUmbracoApplicationTest.cs @@ -164,7 +164,7 @@ namespace Umbraco.Tests.TestHelpers var evtMsgs = new TransientMessagesFactory(); var applicationContext = new ApplicationContext( //assign the db context - new DatabaseContext(new DefaultDatabaseFactory(Core.Configuration.GlobalSettings.UmbracoConnectionName, Logger), Logger, sqlSyntax, Constants.DatabaseProviders.SqlCe), + new DatabaseContext(new DefaultDatabaseFactory(Constants.System.UmbracoConnectionName, Logger), Logger, sqlSyntax, Constants.DatabaseProviders.SqlCe), //assign the service context new ServiceContext(repoFactory, new PetaPocoUnitOfWorkProvider(Logger), new FileUnitOfWorkProvider(), new PublishingStrategy(evtMsgs, Logger), CacheHelper, Logger, evtMsgs), CacheHelper, diff --git a/src/Umbraco.Tests/TestHelpers/TestHelper.cs b/src/Umbraco.Tests/TestHelpers/TestHelper.cs index de62bff271..b8deae0621 100644 --- a/src/Umbraco.Tests/TestHelpers/TestHelper.cs +++ b/src/Umbraco.Tests/TestHelpers/TestHelper.cs @@ -28,7 +28,7 @@ namespace Umbraco.Tests.TestHelpers /// public static void ClearDatabase() { - var databaseSettings = ConfigurationManager.ConnectionStrings[Core.Configuration.GlobalSettings.UmbracoConnectionName]; + var databaseSettings = ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName]; var dataHelper = DataLayerHelper.CreateSqlHelper(databaseSettings.ConnectionString, false) as SqlCEHelper; if (dataHelper == null) @@ -39,7 +39,7 @@ namespace Umbraco.Tests.TestHelpers public static void DropForeignKeys(string table) { - var databaseSettings = ConfigurationManager.ConnectionStrings[Core.Configuration.GlobalSettings.UmbracoConnectionName]; + var databaseSettings = ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName]; var dataHelper = DataLayerHelper.CreateSqlHelper(databaseSettings.ConnectionString, false) as SqlCEHelper; if (dataHelper == null) diff --git a/src/Umbraco.Web/Install/InstallHelper.cs b/src/Umbraco.Web/Install/InstallHelper.cs index d39b16f6ac..de101394c1 100644 --- a/src/Umbraco.Web/Install/InstallHelper.cs +++ b/src/Umbraco.Web/Install/InstallHelper.cs @@ -146,7 +146,7 @@ namespace Umbraco.Web.Install { get { - var databaseSettings = ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName]; + var databaseSettings = ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName]; if (GlobalSettings.ConfigurationStatus.IsNullOrWhiteSpace() && _umbContext.Application.DatabaseContext.IsConnectionStringConfigured(databaseSettings) == false) { diff --git a/src/Umbraco.Web/Install/InstallSteps/DatabaseConfigureStep.cs b/src/Umbraco.Web/Install/InstallSteps/DatabaseConfigureStep.cs index 4854919efb..ce28a26176 100644 --- a/src/Umbraco.Web/Install/InstallSteps/DatabaseConfigureStep.cs +++ b/src/Umbraco.Web/Install/InstallSteps/DatabaseConfigureStep.cs @@ -83,7 +83,7 @@ namespace Umbraco.Web.Install.InstallSteps private bool ShouldDisplayView() { //If the connection string is already present in web.config we don't need to show the settings page and we jump to installing/upgrading. - var databaseSettings = ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName]; + var databaseSettings = ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName]; if (_applicationContext.DatabaseContext.IsConnectionStringConfigured(databaseSettings)) { diff --git a/src/Umbraco.Web/Install/InstallSteps/DatabaseInstallStep.cs b/src/Umbraco.Web/Install/InstallSteps/DatabaseInstallStep.cs index 57c8e67465..b75a310546 100644 --- a/src/Umbraco.Web/Install/InstallSteps/DatabaseInstallStep.cs +++ b/src/Umbraco.Web/Install/InstallSteps/DatabaseInstallStep.cs @@ -48,13 +48,13 @@ namespace Umbraco.Web.Install.InstallSteps internal static void HandleConnectionStrings() { // Remove legacy umbracoDbDsn configuration setting if it exists and connectionstring also exists - if (ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName] != null) + if (ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName] != null) { - GlobalSettings.RemoveSetting(GlobalSettings.UmbracoConnectionName); + GlobalSettings.RemoveSetting(Constants.System.UmbracoConnectionName); } else { - var ex = new ArgumentNullException(string.Format("ConfigurationManager.ConnectionStrings[{0}]", GlobalSettings.UmbracoConnectionName), "Install / upgrade did not complete successfully, umbracoDbDSN was not set in the connectionStrings section"); + var ex = new ArgumentNullException(string.Format("ConfigurationManager.ConnectionStrings[{0}]", Constants.System.UmbracoConnectionName), "Install / upgrade did not complete successfully, umbracoDbDSN was not set in the connectionStrings section"); LogHelper.Error("", ex); throw ex; } diff --git a/src/Umbraco.Web/Install/InstallSteps/DatabaseUpgradeStep.cs b/src/Umbraco.Web/Install/InstallSteps/DatabaseUpgradeStep.cs index 678ae427e5..c3ae313898 100644 --- a/src/Umbraco.Web/Install/InstallSteps/DatabaseUpgradeStep.cs +++ b/src/Umbraco.Web/Install/InstallSteps/DatabaseUpgradeStep.cs @@ -58,7 +58,7 @@ namespace Umbraco.Web.Install.InstallSteps return false; } - var databaseSettings = ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName]; + var databaseSettings = ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName]; if (_applicationContext.DatabaseContext.IsConnectionStringConfigured(databaseSettings)) { diff --git a/src/Umbraco.Web/Install/InstallSteps/NewInstallStep.cs b/src/Umbraco.Web/Install/InstallSteps/NewInstallStep.cs index fd36d8e4e6..775fcaaf9c 100644 --- a/src/Umbraco.Web/Install/InstallSteps/NewInstallStep.cs +++ b/src/Umbraco.Web/Install/InstallSteps/NewInstallStep.cs @@ -118,7 +118,7 @@ namespace Umbraco.Web.Install.InstallSteps public override bool RequiresExecution(UserModel model) { //now we have to check if this is really a new install, the db might be configured and might contain data - var databaseSettings = ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName]; + var databaseSettings = ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName]; //if there's already a version then there should def be a user but in some cases someone may have // left a version number in there but cleared out their db conn string, in that case, it's really a new install. diff --git a/src/Umbraco.Web/Models/ContentEditing/UmbracoEntityTypes.cs b/src/Umbraco.Web/Models/ContentEditing/UmbracoEntityTypes.cs index 824dcb2b91..c68ee3c655 100644 --- a/src/Umbraco.Web/Models/ContentEditing/UmbracoEntityTypes.cs +++ b/src/Umbraco.Web/Models/ContentEditing/UmbracoEntityTypes.cs @@ -1,4 +1,7 @@ -namespace Umbraco.Web.Models.ContentEditing +using System; +using System.ComponentModel; + +namespace Umbraco.Web.Models.ContentEditing { /// /// Represents the type's of Umbraco entities that can be resolved from the EntityController @@ -53,6 +56,8 @@ /// /// Content Item /// + [Obsolete("This is not used and will be removed in future versions")] + [EditorBrowsable(EditorBrowsableState.Never)] ContentItem, /// diff --git a/src/Umbraco.Web/Strategies/Migrations/ClearCsrfCookiesAfterUpgrade.cs b/src/Umbraco.Web/Strategies/Migrations/ClearCsrfCookiesAfterUpgrade.cs index 4a316fe96f..f1d7f761af 100644 --- a/src/Umbraco.Web/Strategies/Migrations/ClearCsrfCookiesAfterUpgrade.cs +++ b/src/Umbraco.Web/Strategies/Migrations/ClearCsrfCookiesAfterUpgrade.cs @@ -4,6 +4,7 @@ using Umbraco.Core.Events; using Umbraco.Core.Persistence.Migrations; using Umbraco.Web.WebApi.Filters; using umbraco.interfaces; +using Umbraco.Core; using Umbraco.Core.Configuration; namespace Umbraco.Web.Strategies.Migrations @@ -15,7 +16,7 @@ namespace Umbraco.Web.Strategies.Migrations { protected override void AfterMigration(MigrationRunner sender, MigrationEventArgs e) { - if (e.ProductName != GlobalSettings.UmbracoMigrationName) return; + if (e.ProductName != Constants.System.UmbracoMigrationName) return; if (HttpContext.Current == null) return; diff --git a/src/Umbraco.Web/Strategies/Migrations/ClearMediaXmlCacheForDeletedItemsAfterUpgrade.cs b/src/Umbraco.Web/Strategies/Migrations/ClearMediaXmlCacheForDeletedItemsAfterUpgrade.cs index cf9ddeafb2..52144ae383 100644 --- a/src/Umbraco.Web/Strategies/Migrations/ClearMediaXmlCacheForDeletedItemsAfterUpgrade.cs +++ b/src/Umbraco.Web/Strategies/Migrations/ClearMediaXmlCacheForDeletedItemsAfterUpgrade.cs @@ -21,7 +21,7 @@ namespace Umbraco.Web.Strategies.Migrations { protected override void AfterMigration(MigrationRunner sender, MigrationEventArgs e) { - if (e.ProductName != GlobalSettings.UmbracoMigrationName) return; + if (e.ProductName != Constants.System.UmbracoMigrationName) return; var target70 = new Version(7, 0, 0); diff --git a/src/Umbraco.Web/Strategies/Migrations/EnsureListViewDataTypeIsCreated.cs b/src/Umbraco.Web/Strategies/Migrations/EnsureListViewDataTypeIsCreated.cs index 270fe4eace..45eb0a92b3 100644 --- a/src/Umbraco.Web/Strategies/Migrations/EnsureListViewDataTypeIsCreated.cs +++ b/src/Umbraco.Web/Strategies/Migrations/EnsureListViewDataTypeIsCreated.cs @@ -21,7 +21,7 @@ namespace Umbraco.Web.Strategies.Migrations { protected override void AfterMigration(MigrationRunner sender, MigrationEventArgs e) { - if (e.ProductName != GlobalSettings.UmbracoMigrationName) return; + if (e.ProductName != Constants.System.UmbracoMigrationName) return; var target720 = new Version(7, 2, 0); diff --git a/src/Umbraco.Web/Strategies/Migrations/OverwriteStylesheetFilesFromTempFiles.cs b/src/Umbraco.Web/Strategies/Migrations/OverwriteStylesheetFilesFromTempFiles.cs index 9a8b6a6044..a4e4349372 100644 --- a/src/Umbraco.Web/Strategies/Migrations/OverwriteStylesheetFilesFromTempFiles.cs +++ b/src/Umbraco.Web/Strategies/Migrations/OverwriteStylesheetFilesFromTempFiles.cs @@ -23,7 +23,7 @@ namespace Umbraco.Web.Strategies.Migrations { protected override void AfterMigration(MigrationRunner sender, MigrationEventArgs e) { - if (e.ProductName != GlobalSettings.UmbracoMigrationName) return; + if (e.ProductName != Constants.System.UmbracoMigrationName) return; var target73 = new Version(7, 3, 0); diff --git a/src/Umbraco.Web/Strategies/Migrations/PublishAfterUpgradeToVersionSixth.cs b/src/Umbraco.Web/Strategies/Migrations/PublishAfterUpgradeToVersionSixth.cs index 7be8d818d3..70f0b58f1a 100644 --- a/src/Umbraco.Web/Strategies/Migrations/PublishAfterUpgradeToVersionSixth.cs +++ b/src/Umbraco.Web/Strategies/Migrations/PublishAfterUpgradeToVersionSixth.cs @@ -20,7 +20,7 @@ namespace Umbraco.Web.Strategies.Migrations { protected override void AfterMigration(MigrationRunner sender, MigrationEventArgs e) { - if (e.ProductName != GlobalSettings.UmbracoMigrationName) return; + if (e.ProductName != Constants.System.UmbracoMigrationName) return; var target = new Version(6, 0, 0); if (e.ConfiguredVersion < target) diff --git a/src/Umbraco.Web/Strategies/Migrations/RebuildXmlCachesAfterUpgrade.cs b/src/Umbraco.Web/Strategies/Migrations/RebuildXmlCachesAfterUpgrade.cs index e62a738675..5f8f8b8593 100644 --- a/src/Umbraco.Web/Strategies/Migrations/RebuildXmlCachesAfterUpgrade.cs +++ b/src/Umbraco.Web/Strategies/Migrations/RebuildXmlCachesAfterUpgrade.cs @@ -23,7 +23,7 @@ namespace Umbraco.Web.Strategies.Migrations { protected override void AfterMigration(MigrationRunner sender, MigrationEventArgs e) { - if (e.ProductName != GlobalSettings.UmbracoMigrationName) return; + if (e.ProductName != Constants.System.UmbracoMigrationName) return; var v730 = new Semver.SemVersion(new Version(7, 3, 0)); diff --git a/src/umbraco.businesslogic/Application.cs b/src/umbraco.businesslogic/Application.cs index 2fd7b3cc02..ad6822019b 100644 --- a/src/umbraco.businesslogic/Application.cs +++ b/src/umbraco.businesslogic/Application.cs @@ -44,7 +44,7 @@ namespace umbraco.BusinessLogic try { - const string umbracoDsn = Umbraco.Core.Configuration.GlobalSettings.UmbracoConnectionName; + const string umbracoDsn = Constants.System.UmbracoConnectionName; var databaseSettings = ConfigurationManager.ConnectionStrings[umbracoDsn]; if (databaseSettings != null) diff --git a/src/umbraco.businesslogic/GlobalSettings.cs b/src/umbraco.businesslogic/GlobalSettings.cs index 3d3721f783..9bc725c7c4 100644 --- a/src/umbraco.businesslogic/GlobalSettings.cs +++ b/src/umbraco.businesslogic/GlobalSettings.cs @@ -79,7 +79,7 @@ namespace umbraco /// Gets the database connection string /// /// The database connection string. - [Obsolete("Use System.ConfigurationManager.ConnectionStrings to get the connection with the key Umbraco.Core.Configuration.GlobalSettings.UmbracoConnectionName instead")] + [Obsolete("Use System.ConfigurationManager.ConnectionStrings to get the connection with the key Constants.System.UmbracoConnectionName instead")] public static string DbDSN { get { return Umbraco.Core.Configuration.GlobalSettings.DbDsn; } @@ -359,7 +359,7 @@ namespace umbraco { get { - var databaseSettings = ConfigurationManager.ConnectionStrings[Umbraco.Core.Configuration.GlobalSettings.UmbracoConnectionName]; + var databaseSettings = ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName]; var dataHelper = DataLayerHelper.CreateSqlHelper(databaseSettings.ConnectionString, false); if (HttpContext.Current != null) diff --git a/src/umbraco.cms/businesslogic/datatype/DataEditorSettingsStorage.cs b/src/umbraco.cms/businesslogic/datatype/DataEditorSettingsStorage.cs index 5d2434164f..ddebb2ee2d 100644 --- a/src/umbraco.cms/businesslogic/datatype/DataEditorSettingsStorage.cs +++ b/src/umbraco.cms/businesslogic/datatype/DataEditorSettingsStorage.cs @@ -4,6 +4,7 @@ using System.Configuration; using System.Linq; using System.Text; using umbraco.DataLayer; +using Umbraco.Core; namespace umbraco.cms.businesslogic.datatype { @@ -14,7 +15,7 @@ namespace umbraco.cms.businesslogic.datatype public DataEditorSettingsStorage() { - var databaseSettings = ConfigurationManager.ConnectionStrings[Umbraco.Core.Configuration.GlobalSettings.UmbracoConnectionName]; + var databaseSettings = ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName]; var dataHelper = DataLayerHelper.CreateSqlHelper(databaseSettings.ConnectionString, false); init(DataLayerHelper.CreateSqlHelper(dataHelper.ConnectionString, false)); diff --git a/src/umbraco.datalayer/DataLayerHelper.cs b/src/umbraco.datalayer/DataLayerHelper.cs index 7952b737ec..f79a90a0f1 100644 --- a/src/umbraco.datalayer/DataLayerHelper.cs +++ b/src/umbraco.datalayer/DataLayerHelper.cs @@ -10,6 +10,7 @@ using System; using System.Configuration; using System.Data.Common; using System.Reflection; +using Umbraco.Core; namespace umbraco.DataLayer { @@ -72,7 +73,7 @@ namespace umbraco.DataLayer throw new ArgumentException("Bad connection string.", "connectionString", ex); } - var connectionStringSettings = ConfigurationManager.ConnectionStrings[Umbraco.Core.Configuration.GlobalSettings.UmbracoConnectionName]; + var connectionStringSettings = ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName]; if (forceLegacyConnection == false && connectionStringSettings != null) SetDataHelperNames(connectionStringSettings); From 73f77df5adee6f126b0691769203624b6a45b5d0 Mon Sep 17 00:00:00 2001 From: Per Ploug Date: Thu, 12 Jan 2017 09:47:33 +0100 Subject: [PATCH 34/39] Ensures VirtualPath is reset if a template alias is changed --- src/Umbraco.Web/Editors/TemplateController.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Web/Editors/TemplateController.cs b/src/Umbraco.Web/Editors/TemplateController.cs index 58a4053de1..83a6bb5fe1 100644 --- a/src/Umbraco.Web/Editors/TemplateController.cs +++ b/src/Umbraco.Web/Editors/TemplateController.cs @@ -49,7 +49,7 @@ namespace Umbraco.Web.Editors var template = Services.FileService.GetTemplate(id); if (template == null) throw new HttpResponseException(HttpStatusCode.NotFound); - + return Mapper.Map(template); } @@ -103,7 +103,9 @@ namespace Umbraco.Web.Editors if (template == null) throw new HttpResponseException(HttpStatusCode.NotFound); - var changeMaster = template.MasterTemplateAlias != display.MasterTemplateAlias; + var changeMaster = template.MasterTemplateAlias != display.MasterTemplateAlias; + var changeAlias = template.Alias != display.Alias; + Mapper.Map(display, template); if (changeMaster) @@ -128,7 +130,12 @@ namespace Umbraco.Web.Editors } } - Services.FileService.SaveTemplate(template); + Services.FileService.SaveTemplate(template); + + if (changeAlias) + { + template = Services.FileService.GetTemplate(template.Id); + } Mapper.Map(template, display); } @@ -144,6 +151,7 @@ namespace Umbraco.Web.Editors } var template = Services.FileService.CreateTemplateWithIdentity(display.Name, display.Content, master); + //template = Services.FileService.GetTemplate(template.Id); Mapper.Map(template, display); } From 20850632314e1c8dca0a2d5a3a9eed9731436fed Mon Sep 17 00:00:00 2001 From: Per Ploug Date: Thu, 12 Jan 2017 10:07:44 +0100 Subject: [PATCH 35/39] Fixes issue with creating template below a parent template --- .../src/common/resources/template.resource.js | 5 +- .../src/views/templates/edit.controller.js | 2 +- src/Umbraco.Web/Editors/TemplateController.cs | 305 +++++++++--------- 3 files changed, 162 insertions(+), 150 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/template.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/template.resource.js index c90bb1766d..3052d532bb 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/template.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/template.resource.js @@ -107,13 +107,14 @@ function templateResource($q, $http, umbDataFormatter, umbRequestHelper) { * @returns {Promise} resourcePromise object containing the template scaffold. * */ - getScaffold: function () { + getScaffold: function (id) { return umbRequestHelper.resourcePromise( $http.get( umbRequestHelper.getApiUrl( "templateApiBaseUrl", - "GetEmpty")), + "GetScaffold", + [{ id: id }] )), "Failed to retrieve data for empty template"); }, diff --git a/src/Umbraco.Web.UI.Client/src/views/templates/edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/templates/edit.controller.js index e67273850f..8e2b8337ad 100644 --- a/src/Umbraco.Web.UI.Client/src/views/templates/edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/templates/edit.controller.js @@ -95,7 +95,7 @@ if($routeParams.create){ - templateResource.getScaffold().then(function(template){ + templateResource.getScaffold(($routeParams.id)).then(function (template) { vm.ready(template); }); diff --git a/src/Umbraco.Web/Editors/TemplateController.cs b/src/Umbraco.Web/Editors/TemplateController.cs index 83a6bb5fe1..40effc10fa 100644 --- a/src/Umbraco.Web/Editors/TemplateController.cs +++ b/src/Umbraco.Web/Editors/TemplateController.cs @@ -1,161 +1,172 @@ -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Web.Http; -using AutoMapper; -using Umbraco.Core.IO; -using Umbraco.Core.Models; -using Umbraco.Core.Services; -using Umbraco.Web.Models.ContentEditing; -using Umbraco.Web.Mvc; -using Umbraco.Web.WebApi; -using Umbraco.Web.WebApi.Filters; -using Constants = Umbraco.Core.Constants; - -namespace Umbraco.Web.Editors -{ - [PluginController("UmbracoApi")] - [UmbracoTreeAuthorize(Constants.Trees.Templates)] - public class TemplateController : BackOfficeNotificationsController - { - /// - /// Gets data type by alias - /// - /// - /// - public TemplateDisplay GetByAlias(string alias) - { - var template = Services.FileService.GetTemplate(alias); - return template == null ? null : Mapper.Map(template); - } - - /// - /// Get all templates - /// - /// - public IEnumerable GetAll() - { - return Services.FileService.GetTemplates().Select(Mapper.Map); - } - - /// - /// Gets the content json for the content id - /// - /// - /// - public TemplateDisplay GetById(int id) - { - var template = Services.FileService.GetTemplate(id); - if (template == null) - throw new HttpResponseException(HttpStatusCode.NotFound); - - return Mapper.Map(template); - } - - /// - /// Deletes a template wth a given ID - /// - /// - /// - [HttpDelete] - [HttpPost] - public HttpResponseMessage DeleteById(int id) - { - var template = Services.FileService.GetTemplate(id); - if (template == null) - throw new HttpResponseException(HttpStatusCode.NotFound); - - Services.FileService.DeleteTemplate(template.Alias); - return Request.CreateResponse(HttpStatusCode.OK); - } - - public TemplateDisplay GetEmpty() - { - var dt = new Template("", ""); - var content = ViewHelper.GetDefaultFileContent(); - - var scaffold = Mapper.Map(dt); - scaffold.Path = "-1"; - scaffold.Content = content + "\r\n\r\n@* the fun starts here *@\r\n\r\n"; - return scaffold; - } - - /// - /// Saves the data type - /// - /// - /// - public TemplateDisplay PostSave(TemplateDisplay display) - { - - //Checking the submitted is valid with the Required attributes decorated on the ViewModel - if (ModelState.IsValid == false) - { - throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); - } - - - if (display.Id > 0) - { - // update - var template = Services.FileService.GetTemplate(display.Id); - if (template == null) - throw new HttpResponseException(HttpStatusCode.NotFound); - +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Web.Http; +using AutoMapper; +using Umbraco.Core.IO; +using Umbraco.Core.Models; +using Umbraco.Core.Services; +using Umbraco.Web.Models.ContentEditing; +using Umbraco.Web.Mvc; +using Umbraco.Web.WebApi; +using Umbraco.Web.WebApi.Filters; +using Constants = Umbraco.Core.Constants; + +namespace Umbraco.Web.Editors +{ + [PluginController("UmbracoApi")] + [UmbracoTreeAuthorize(Constants.Trees.Templates)] + public class TemplateController : BackOfficeNotificationsController + { + /// + /// Gets data type by alias + /// + /// + /// + public TemplateDisplay GetByAlias(string alias) + { + var template = Services.FileService.GetTemplate(alias); + return template == null ? null : Mapper.Map(template); + } + + /// + /// Get all templates + /// + /// + public IEnumerable GetAll() + { + return Services.FileService.GetTemplates().Select(Mapper.Map); + } + + /// + /// Gets the content json for the content id + /// + /// + /// + public TemplateDisplay GetById(int id) + { + var template = Services.FileService.GetTemplate(id); + if (template == null) + throw new HttpResponseException(HttpStatusCode.NotFound); + + return Mapper.Map(template); + } + + /// + /// Deletes a template wth a given ID + /// + /// + /// + [HttpDelete] + [HttpPost] + public HttpResponseMessage DeleteById(int id) + { + var template = Services.FileService.GetTemplate(id); + if (template == null) + throw new HttpResponseException(HttpStatusCode.NotFound); + + Services.FileService.DeleteTemplate(template.Alias); + return Request.CreateResponse(HttpStatusCode.OK); + } + + public TemplateDisplay GetScaffold(int id) + { + //empty default + var dt = new Template("", ""); + dt.Path = "-1"; + + if (id > 0) + { + var master = Services.FileService.GetTemplate(id); + if(master != null) + { + dt.SetMasterTemplate(master); + } + } + + var content = ViewHelper.GetDefaultFileContent( layoutPageAlias: dt.MasterTemplateAlias ); + var scaffold = Mapper.Map(dt); + + scaffold.Content = content + "\r\n\r\n@* the fun starts here *@\r\n\r\n"; + return scaffold; + } + + /// + /// Saves the data type + /// + /// + /// + public TemplateDisplay PostSave(TemplateDisplay display) + { + + //Checking the submitted is valid with the Required attributes decorated on the ViewModel + if (ModelState.IsValid == false) + { + throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); + } + + + if (display.Id > 0) + { + // update + var template = Services.FileService.GetTemplate(display.Id); + if (template == null) + throw new HttpResponseException(HttpStatusCode.NotFound); + var changeMaster = template.MasterTemplateAlias != display.MasterTemplateAlias; var changeAlias = template.Alias != display.Alias; - Mapper.Map(display, template); - - if (changeMaster) - { - if (string.IsNullOrEmpty(display.MasterTemplateAlias) == false) - { - - var master = Services.FileService.GetTemplate(display.MasterTemplateAlias); + Mapper.Map(display, template); + + if (changeMaster) + { + if (string.IsNullOrEmpty(display.MasterTemplateAlias) == false) + { + + var master = Services.FileService.GetTemplate(display.MasterTemplateAlias); if(master == null || master.Id == display.Id) { template.SetMasterTemplate(null); }else { template.SetMasterTemplate(master); - } - - } - else - { - //remove the master - template.SetMasterTemplate(null); - } - } - + } + + } + else + { + //remove the master + template.SetMasterTemplate(null); + } + } + Services.FileService.SaveTemplate(template); if (changeAlias) { template = Services.FileService.GetTemplate(template.Id); - } - - Mapper.Map(template, display); - } - else - { - //create - ITemplate master = null; - if (string.IsNullOrEmpty(display.MasterTemplateAlias) == false) - { - master = Services.FileService.GetTemplate(display.MasterTemplateAlias); - if (master == null) - throw new HttpResponseException(HttpStatusCode.NotFound); - } - - var template = Services.FileService.CreateTemplateWithIdentity(display.Name, display.Content, master); - //template = Services.FileService.GetTemplate(template.Id); - Mapper.Map(template, display); - } - - return display; - } - } -} + } + + Mapper.Map(template, display); + } + else + { + //create + ITemplate master = null; + if (string.IsNullOrEmpty(display.MasterTemplateAlias) == false) + { + master = Services.FileService.GetTemplate(display.MasterTemplateAlias); + if (master == null) + throw new HttpResponseException(HttpStatusCode.NotFound); + } + + var template = Services.FileService.CreateTemplateWithIdentity(display.Name, display.Content, master); + //template = Services.FileService.GetTemplate(template.Id); + Mapper.Map(template, display); + } + + return display; + } + } +} From 16d8c55fa7610856b15166ae98183468532bdb4d Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Thu, 12 Jan 2017 10:11:03 +0100 Subject: [PATCH 36/39] tree picker search only works for content, media and members so hide for everything else --- .../common/overlays/treepicker/treepicker.controller.js | 5 +++++ .../src/views/common/overlays/treepicker/treepicker.html | 1 + 2 files changed, 6 insertions(+) diff --git a/src/Umbraco.Web.UI.Client/src/views/common/overlays/treepicker/treepicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/overlays/treepicker/treepicker.controller.js index dcc03f1a76..e69b5ee3ce 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/overlays/treepicker/treepicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/overlays/treepicker/treepicker.controller.js @@ -38,6 +38,11 @@ angular.module("umbraco").controller("Umbraco.Overlays.TreePickerController", } } } + + // Search is only working for content, media and member section so we will remove it from everything else + if($scope.section === "content" || $scope.section === "media" || $scope.section === "member" ) { + $scope.enableSearh = true; + } //create the custom query string param for this tree $scope.customTreeParams = dialogOptions.startNodeId ? "startNodeId=" + dialogOptions.startNodeId : ""; diff --git a/src/Umbraco.Web.UI.Client/src/views/common/overlays/treepicker/treepicker.html b/src/Umbraco.Web.UI.Client/src/views/common/overlays/treepicker/treepicker.html index 4e9f503013..b009b4d45f 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/overlays/treepicker/treepicker.html +++ b/src/Umbraco.Web.UI.Client/src/views/common/overlays/treepicker/treepicker.html @@ -2,6 +2,7 @@
Date: Thu, 12 Jan 2017 11:07:37 +0100 Subject: [PATCH 37/39] update docs for template resource --- .../src/common/resources/template.resource.js | 63 +++++++++++++------ 1 file changed, 43 insertions(+), 20 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/template.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/template.resource.js index 3052d532bb..f969864ba1 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/template.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/template.resource.js @@ -40,21 +40,21 @@ function templateResource($q, $http, umbDataFormatter, umbRequestHelper) { /** * @ngdoc method - * @name umbraco.resources.templateResource#getByName + * @name umbraco.resources.templateResource#getByAlias * @methodOf umbraco.resources.templateResource * * @description - * Gets a template item with a given name + * Gets a template item with a given alias * * ##usage *
-         * templateResource.getByName("upload")
-         *    .then(function(datatype) {
+         * templateResource.getByAlias("upload")
+         *    .then(function(template) {
          *        alert('its here!');
          *    });
          * 
* - * @param {String} name Name of template to retrieve + * @param {String} alias Alias of template to retrieve * @returns {Promise} resourcePromise object. * */ @@ -69,6 +69,25 @@ function templateResource($q, $http, umbDataFormatter, umbRequestHelper) { "Failed to retrieve data for template with alias: " + alias); }, + /** + * @ngdoc method + * @name umbraco.resources.templateResource#getAll + * @methodOf umbraco.resources.templateResource + * + * @description + * Gets all templates + * + * ##usage + *
+         * templateResource.getAll()
+         *    .then(function(templates) {
+         *        alert('its here!');
+         *    });
+         * 
+ * + * @returns {Promise} resourcePromise object. + * + */ getAll: function () { return umbRequestHelper.resourcePromise( @@ -82,8 +101,8 @@ function templateResource($q, $http, umbDataFormatter, umbRequestHelper) { /** * @ngdoc method - * @name umbraco.resources.contentResource#getScaffold - * @methodOf umbraco.resources.contentResource + * @name umbraco.resources.templateResource#getScaffold + * @methodOf umbraco.resources.templateResource * * @description * Returns a scaffold of an empty template item @@ -93,14 +112,8 @@ function templateResource($q, $http, umbDataFormatter, umbRequestHelper) { * ##usage *
          * templateResource.getScaffold()
-         *    .then(function(scaffold) {
-         *        var myType = scaffold;
-         *        myType.name = "My new template";
-         *
-         *        templateResource.save(myType, myType.preValues, true)
-         *            .then(function(type){
-         *                alert("Retrieved, updated and saved again");
-         *            });
+         *    .then(function(template) {
+         *        alert('its here!');
          *    });
          * 
* @@ -134,7 +147,7 @@ function templateResource($q, $http, umbDataFormatter, umbRequestHelper) { * }); * * - * @param {Int} id id of content item to delete + * @param {Int} id id of template to delete * @returns {Promise} resourcePromise object. * */ @@ -148,7 +161,6 @@ function templateResource($q, $http, umbDataFormatter, umbRequestHelper) { "Failed to delete item " + id); }, - /** * @ngdoc method * @name umbraco.resources.templateResource#save @@ -156,15 +168,26 @@ function templateResource($q, $http, umbDataFormatter, umbRequestHelper) { * * @description * Saves or update a template + * + * ##usage + *
+         * templateResource.save(template)
+         *    .then(function(template) {
+         *        alert('its saved!');
+         *    });
+         * 
* - * @param {Object} template object to create/update + * @param {Object} template object to save * @returns {Promise} resourcePromise object. * */ save: function (template) { - return umbRequestHelper.resourcePromise( - $http.post(umbRequestHelper.getApiUrl("templateApiBaseUrl", "PostSave"), template), + $http.post( + umbRequestHelper.getApiUrl( + "templateApiBaseUrl", + "PostSave"), + template), "Failed to save data for template id " + template.id); } }; From 32abebd0a010fecff4faea397f7cfde7cd2604c1 Mon Sep 17 00:00:00 2001 From: Per Ploug Date: Thu, 12 Jan 2017 11:33:21 +0100 Subject: [PATCH 38/39] Main template editor translated --- .../views/common/overlays/insert/insert.html | 21 +++++----- .../querybuilder/querybuilder.controller.js | 1 - .../overlays/querybuilder/querybuilder.html | 16 +++++--- .../src/views/templates/edit.html | 14 +++---- src/Umbraco.Web.UI/umbraco/config/lang/en.xml | 39 +++++++++++++++++-- 5 files changed, 62 insertions(+), 29 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/common/overlays/insert/insert.html b/src/Umbraco.Web.UI.Client/src/views/common/overlays/insert/insert.html index e5ea8a3ddf..4b92ea86ad 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/overlays/insert/insert.html +++ b/src/Umbraco.Web.UI.Client/src/views/common/overlays/insert/insert.html @@ -3,29 +3,28 @@
-
Value
-
Displays the value of a named field from the current page, with options to modify the value or fallback to alternative values.
+
+
-
Partial view
+
- A partial view is a separate template file which can be rendered inside another - template, it's great for reusing markup or for separating complex templates into separate files.
+ +
-
Macro
+
- A Macro is a configurable component which is great for - reusable parts of your design, where you need the option to provide parameters, - such as galleries, forms and lists. + +
-
Dictionary
-
A dictionary item is a placeholder for a translatable piece of text, which makes it easy to create designs for multilingual websites.
+
+
diff --git a/src/Umbraco.Web.UI.Client/src/views/common/overlays/querybuilder/querybuilder.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/overlays/querybuilder/querybuilder.controller.js index d04b7f35a3..3939882969 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/overlays/querybuilder/querybuilder.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/overlays/querybuilder/querybuilder.controller.js @@ -173,7 +173,6 @@ }, 200); onInit(); - } angular.module("umbraco").controller("Umbraco.Overlays.QueryBuilderController", QueryBuilderOverlayController); diff --git a/src/Umbraco.Web.UI.Client/src/views/common/overlays/querybuilder/querybuilder.html b/src/Umbraco.Web.UI.Client/src/views/common/overlays/querybuilder/querybuilder.html index 36f729adb0..e9be97b7df 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/overlays/querybuilder/querybuilder.html +++ b/src/Umbraco.Web.UI.Client/src/views/common/overlays/querybuilder/querybuilder.html @@ -5,7 +5,7 @@
- I want + I Want
@@ -22,7 +22,7 @@
- from + from {{vm.query.source.name}} @@ -33,8 +33,12 @@ diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml index f7ac08d837..2021be1d9d 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml @@ -1025,17 +1025,48 @@ To manage your website, simply open the Umbraco back office and start adding con Preview Styles + Edit template + + Sections Insert content area Insert content area placeholder - Insert dictionary item - Insert Macro - Insert Umbraco page field + + Dictionary item + A dictionary item is a placeholder for a translatable piece of text, which makes it easy to create designs for multilingual websites. + + Macro + + A Macro is a configurable component which is great for + reusable parts of your design, where you need the option to provide parameters, + such as galleries, forms and lists. + + + Value + Displays the value of a named field from the current page, with options to modify the value or fallback to alternative values. + + Partial view + + A partial view is a separate template file which can be rendered inside another + template, it's great for reusing markup or for separating complex templates into separate files. + + Master template - Quick Guide to Umbraco template tags + + Query builder + items returned, in + + I want + from + where + and + everything + + Template + Choose type of content Choose a layout From 04f79ffaf122f84aa1b09a3aa0260377e9f0edf1 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Thu, 12 Jan 2017 15:31:21 +0100 Subject: [PATCH 39/39] lazy load ace editor source file - change to an isolated scope and don't rely on ngModel to get it working --- .../components/umbaceeditor.directive.js | 392 +++++++++--------- .../src/views/templates/edit.html | 3 +- src/Umbraco.Web/UI/JavaScript/JsInitialize.js | 2 +- 3 files changed, 195 insertions(+), 202 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbaceeditor.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbaceeditor.directive.js index 6e66e75dd6..c97851bbb9 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbaceeditor.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbaceeditor.directive.js @@ -1,11 +1,7 @@ (function() { 'use strict'; - function AceEditorDirective(umbAceEditorConfig, assetsService) { - - if (angular.isUndefined(window.ace)) { - throw new Error('ui-ace need ace to work... (o rly?)'); - } + function AceEditorDirective(umbAceEditorConfig, assetsService, angularHelper) { /** * Sets editor options such as the wrapping mode or the syntax checker. @@ -128,213 +124,211 @@ function link(scope, el, attr, ngModel) { - - /** - * Corresponds the umbAceEditorConfig ACE configuration. - * @type object - */ - var options = umbAceEditorConfig.ace || {}; - - /** - * umbAceEditorConfig merged with user options via json in attribute or data binding - * @type object - */ - var opts = angular.extend({}, options, scope.$eval(attr.umbAceEditor)); - - - //load ace libraries here... - - /** - * ACE editor - * @type object - */ - var acee = window.ace.edit(el[0]); - acee.$blockScrolling = Infinity; - - /** - * ACE editor session. - * @type object - * @see [EditSession]{@link http://ace.c9.io/#nav=api&api=edit_session} - */ - var session = acee.getSession(); - - /** - * Reference to a change listener created by the listener factory. - * @function - * @see listenerFactory.onChange - */ - var onChangeListener; - - /** - * Reference to a blur listener created by the listener factory. - * @function - * @see listenerFactory.onBlur - */ - var onBlurListener; - - /** - * Calls a callback by checking its existing. The argument list - * is variable and thus this function is relying on the arguments - * object. - * @throws {Error} If the callback isn't a function - */ - var executeUserCallback = function() { - - /** - * The callback function grabbed from the array-like arguments - * object. The first argument should always be the callback. - * - * @see [arguments]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions_and_function_scope/arguments} - * @type {*} - */ - var callback = arguments[0]; - - /** - * Arguments to be passed to the callback. These are taken - * from the array-like arguments object. The first argument - * is stripped because that should be the callback function. - * - * @see [arguments]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions_and_function_scope/arguments} - * @type {Array} - */ - var args = Array.prototype.slice.call(arguments, 1); - - if (angular.isDefined(callback)) { - scope.$evalAsync(function() { - if (angular.isFunction(callback)) { - callback(args); - } else { - throw new Error('ui-ace use a function as callback.'); - } - }); + // Load in ace library + assetsService.loadJs('lib/ace-builds/src-min-noconflict/ace.js').then(function () { + if (angular.isUndefined(window.ace)) { + throw new Error('ui-ace need ace to work... (o rly?)'); + } else { + // init editor + init(); } - }; - - - - /** - * Listener factory. Until now only change listeners can be created. - * @type object - */ - var listenerFactory = { - /** - * Creates a change listener which propagates the change event - * and the editor session to the callback from the user option - * onChange. It might be exchanged during runtime, if this - * happens the old listener will be unbound. - * - * @param callback callback function defined in the user options - * @see onChangeListener - */ - onChange: function(callback) { - return function(e) { - var newValue = session.getValue(); - - if (ngModel && newValue !== ngModel.$viewValue && - // HACK make sure to only trigger the apply outside of the - // digest loop 'cause ACE is actually using this callback - // for any text transformation ! - !scope.$$phase && !scope.$root.$$phase) { - scope.$evalAsync(function() { - ngModel.$setViewValue(newValue); - }); - } - - executeUserCallback(callback, e, acee); - }; - }, - /** - * Creates a blur listener which propagates the editor session - * to the callback from the user option onBlur. It might be - * exchanged during runtime, if this happens the old listener - * will be unbound. - * - * @param callback callback function defined in the user options - * @see onBlurListener - */ - onBlur: function(callback) { - return function() { - executeUserCallback(callback, acee); - }; - } - }; - - attr.$observe('readonly', function(value) { - acee.setReadOnly(!!value || value === ''); }); - // Value Blind - if (ngModel) { - ngModel.$formatters.push(function(value) { - if (angular.isUndefined(value) || value === null) { - return ''; - } else if (angular.isObject(value) || angular.isArray(value)) { - throw new Error('ui-ace cannot use an object or an array as a model'); + function init() { + + /** + * Corresponds the umbAceEditorConfig ACE configuration. + * @type object + */ + var options = umbAceEditorConfig.ace || {}; + + /** + * umbAceEditorConfig merged with user options via json in attribute or data binding + * @type object + */ + var opts = angular.extend({}, options, scope.umbAceEditor); + + + //load ace libraries here... + + /** + * ACE editor + * @type object + */ + var acee = window.ace.edit(el[0]); + acee.$blockScrolling = Infinity; + + /** + * ACE editor session. + * @type object + * @see [EditSession]{@link http://ace.c9.io/#nav=api&api=edit_session} + */ + var session = acee.getSession(); + + /** + * Reference to a change listener created by the listener factory. + * @function + * @see listenerFactory.onChange + */ + var onChangeListener; + + /** + * Reference to a blur listener created by the listener factory. + * @function + * @see listenerFactory.onBlur + */ + var onBlurListener; + + /** + * Calls a callback by checking its existing. The argument list + * is variable and thus this function is relying on the arguments + * object. + * @throws {Error} If the callback isn't a function + */ + var executeUserCallback = function() { + + /** + * The callback function grabbed from the array-like arguments + * object. The first argument should always be the callback. + * + * @see [arguments]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions_and_function_scope/arguments} + * @type {*} + */ + var callback = arguments[0]; + + /** + * Arguments to be passed to the callback. These are taken + * from the array-like arguments object. The first argument + * is stripped because that should be the callback function. + * + * @see [arguments]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions_and_function_scope/arguments} + * @type {Array} + */ + var args = Array.prototype.slice.call(arguments, 1); + + if (angular.isDefined(callback)) { + scope.$evalAsync(function() { + if (angular.isFunction(callback)) { + callback(args); + } else { + throw new Error('ui-ace use a function as callback.'); + } + }); } - return value; + }; + + + + /** + * Listener factory. Until now only change listeners can be created. + * @type object + */ + var listenerFactory = { + /** + * Creates a change listener which propagates the change event + * and the editor session to the callback from the user option + * onChange. It might be exchanged during runtime, if this + * happens the old listener will be unbound. + * + * @param callback callback function defined in the user options + * @see onChangeListener + */ + onChange: function(callback) { + return function(e) { + var newValue = session.getValue(); + angularHelper.safeApply(scope, function () { + scope.model = newValue; + }); + executeUserCallback(callback, e, acee); + }; + }, + /** + * Creates a blur listener which propagates the editor session + * to the callback from the user option onBlur. It might be + * exchanged during runtime, if this happens the old listener + * will be unbound. + * + * @param callback callback function defined in the user options + * @see onBlurListener + */ + onBlur: function(callback) { + return function() { + executeUserCallback(callback, acee); + }; + } + }; + + attr.$observe('readonly', function(value) { + acee.setReadOnly(!!value || value === ''); }); - ngModel.$render = function() { - session.setValue(ngModel.$viewValue); + // Value Blind + if(scope.model) { + session.setValue(scope.model); + } + + // Listen for option updates + var updateOptions = function(current, previous) { + if (current === previous) { + return; + } + + opts = angular.extend({}, options, scope.umbAceEditor); + + opts.callbacks = [opts.onLoad]; + if (opts.onLoad !== options.onLoad) { + // also call the global onLoad handler + opts.callbacks.unshift(options.onLoad); + } + + // EVENTS + + // unbind old change listener + session.removeListener('change', onChangeListener); + + // bind new change listener + onChangeListener = listenerFactory.onChange(opts.onChange); + session.on('change', onChangeListener); + + // unbind old blur listener + //session.removeListener('blur', onBlurListener); + acee.removeListener('blur', onBlurListener); + + // bind new blur listener + onBlurListener = listenerFactory.onBlur(opts.onBlur); + acee.on('blur', onBlurListener); + + setOptions(acee, session, opts); }; + + scope.$watch(scope.umbAceEditor, updateOptions, /* deep watch */ true); + + // set the options here, even if we try to watch later, if this + // line is missing things go wrong (and the tests will also fail) + updateOptions(options); + + el.on('$destroy', function() { + acee.session.$stopWorker(); + acee.destroy(); + }); + + scope.$watch(function() { + return [el[0].offsetWidth, el[0].offsetHeight]; + }, function() { + acee.resize(); + acee.renderer.updateFull(); + }, true); + } - // Listen for option updates - var updateOptions = function(current, previous) { - if (current === previous) { - return; - } - opts = angular.extend({}, options, scope.$eval(attr.umbAceEditor)); - - opts.callbacks = [opts.onLoad]; - if (opts.onLoad !== options.onLoad) { - // also call the global onLoad handler - opts.callbacks.unshift(options.onLoad); - } - - // EVENTS - - // unbind old change listener - session.removeListener('change', onChangeListener); - - // bind new change listener - onChangeListener = listenerFactory.onChange(opts.onChange); - session.on('change', onChangeListener); - - // unbind old blur listener - //session.removeListener('blur', onBlurListener); - acee.removeListener('blur', onBlurListener); - - // bind new blur listener - onBlurListener = listenerFactory.onBlur(opts.onBlur); - acee.on('blur', onBlurListener); - - setOptions(acee, session, opts); - }; - - scope.$watch(attr.umbAceEditor, updateOptions, /* deep watch */ true); - - // set the options here, even if we try to watch later, if this - // line is missing things go wrong (and the tests will also fail) - updateOptions(options); - - el.on('$destroy', function() { - acee.session.$stopWorker(); - acee.destroy(); - }); - - scope.$watch(function() { - return [el[0].offsetWidth, el[0].offsetHeight]; - }, function() { - acee.resize(); - acee.renderer.updateFull(); - }, true); - } var directive = { restrict: 'EA', - require: '?ngModel', + scope: { + "umbAceEditor": "=", + "model": "=" + }, link: link }; diff --git a/src/Umbraco.Web.UI.Client/src/views/templates/edit.html b/src/Umbraco.Web.UI.Client/src/views/templates/edit.html index b0e15e8ad7..81dc9042b3 100644 --- a/src/Umbraco.Web.UI.Client/src/views/templates/edit.html +++ b/src/Umbraco.Web.UI.Client/src/views/templates/edit.html @@ -89,10 +89,9 @@
+ model="vm.template.content">
- diff --git a/src/Umbraco.Web/UI/JavaScript/JsInitialize.js b/src/Umbraco.Web/UI/JavaScript/JsInitialize.js index 44a1ae75c7..3be8a58983 100644 --- a/src/Umbraco.Web/UI/JavaScript/JsInitialize.js +++ b/src/Umbraco.Web/UI/JavaScript/JsInitialize.js @@ -16,7 +16,7 @@ 'lib/ng-file-upload/ng-file-upload.min.js', 'lib/angular-local-storage/angular-local-storage.min.js', - "lib/ace-builds/src-min-noconflict/ace.js", + //"lib/ace-builds/src-min-noconflict/ace.js", 'lib/bootstrap/js/bootstrap.2.3.2.min.js', 'lib/bootstrap-tabdrop/bootstrap-tabdrop.js',