From 91129632244cb7efb44434fb99be0db1571cdd68 Mon Sep 17 00:00:00 2001 From: Warren Buckley Date: Wed, 11 Aug 2021 13:25:13 +0100 Subject: [PATCH 1/6] Remove System.Configuration.ConfigurationManager --- src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj b/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj index 2f709d5d27..88a43fd1c1 100644 --- a/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj +++ b/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj @@ -46,7 +46,6 @@ - From ec15f20fdf8a8d4be79c23b8f3e737869c3d11b6 Mon Sep 17 00:00:00 2001 From: Warren Buckley Date: Wed, 11 Aug 2021 13:26:28 +0100 Subject: [PATCH 2/6] Replace excetion type from System.Configuration --- src/Umbraco.PublishedCache.NuCache/DataSource/BTree.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.PublishedCache.NuCache/DataSource/BTree.cs b/src/Umbraco.PublishedCache.NuCache/DataSource/BTree.cs index c813e428d2..2d276fbaf4 100644 --- a/src/Umbraco.PublishedCache.NuCache/DataSource/BTree.cs +++ b/src/Umbraco.PublishedCache.NuCache/DataSource/BTree.cs @@ -1,7 +1,7 @@ -using System.Configuration; using CSharpTest.Net.Collections; using CSharpTest.Net.Serialization; using Umbraco.Cms.Core.Configuration.Models; +using Umbraco.Cms.Core.Exceptions; namespace Umbraco.Cms.Infrastructure.PublishedCache.DataSource { @@ -54,9 +54,9 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache.DataSource for (var i = blockSize; i != 1; i >>= 1) bit++; if (1 << bit != blockSize) - throw new ConfigurationErrorsException($"Invalid block size value \"{blockSize}\": must be a power of two."); + throw new ConfigurationException($"Invalid block size value \"{blockSize}\": must be a power of two."); if (blockSize < 512 || blockSize > 65536) - throw new ConfigurationErrorsException($"Invalid block size value \"{blockSize}\": must be >= 512 and <= 65536."); + throw new ConfigurationException($"Invalid block size value \"{blockSize}\": must be >= 512 and <= 65536."); return blockSize; } From 485730b77636f946e384a797232f8b439527137f Mon Sep 17 00:00:00 2001 From: Warren Buckley Date: Wed, 11 Aug 2021 13:27:03 +0100 Subject: [PATCH 3/6] Use TestData Options/Settings as opposed to ConfigManager --- src/Umbraco.TestData/SegmentTestController.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.TestData/SegmentTestController.cs b/src/Umbraco.TestData/SegmentTestController.cs index 8eabd65288..92c01bcf7f 100644 --- a/src/Umbraco.TestData/SegmentTestController.cs +++ b/src/Umbraco.TestData/SegmentTestController.cs @@ -1,7 +1,7 @@ using System; -using System.Configuration; using System.Linq; using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Options; using Umbraco.Cms.Core.Cache; using Umbraco.Cms.Core.Logging; using Umbraco.Cms.Core.Models; @@ -11,25 +11,30 @@ using Umbraco.Cms.Core.Web; using Umbraco.Cms.Infrastructure.Persistence; using Umbraco.Cms.Web.Website.Controllers; using Umbraco.Extensions; +using Umbraco.TestData.Configuration; namespace Umbraco.TestData { public class SegmentTestController : SurfaceController { + private IOptions _testDataSettings; + public SegmentTestController( IUmbracoContextAccessor umbracoContextAccessor, IUmbracoDatabaseFactory databaseFactory, ServiceContext services, AppCaches appCaches, IProfilingLogger profilingLogger, - IPublishedUrlProvider publishedUrlProvider) + IPublishedUrlProvider publishedUrlProvider, + IOptions testDataSettings) : base(umbracoContextAccessor, databaseFactory, services, appCaches, profilingLogger, publishedUrlProvider) { + _testDataSettings = testDataSettings; } public IActionResult EnableDocTypeSegments(string alias, string propertyTypeAlias) { - if (ConfigurationManager.AppSettings["Umbraco.TestData.Enabled"] != "true") + if(_testDataSettings.Value.Enabled != true) { return HttpNotFound(); } @@ -62,7 +67,7 @@ namespace Umbraco.TestData public IActionResult DisableDocTypeSegments(string alias) { - if (ConfigurationManager.AppSettings["Umbraco.TestData.Enabled"] != "true") + if (_testDataSettings.Value.Enabled != true) { return HttpNotFound(); } From f09ec194fe2446d9d7c1379847bc07f9bd1ecffa Mon Sep 17 00:00:00 2001 From: Warren Buckley Date: Wed, 11 Aug 2021 13:27:28 +0100 Subject: [PATCH 4/6] Remove System.Configuration from tests --- .../Umbraco.Core/Composing/TypeFinderTests.cs | 1 - .../Umbraco.Core/Composing/TypeLoaderTests.cs | 1 - 2 files changed, 2 deletions(-) diff --git a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Composing/TypeFinderTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Composing/TypeFinderTests.cs index c55b577845..cbdb2ac5b8 100644 --- a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Composing/TypeFinderTests.cs +++ b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Composing/TypeFinderTests.cs @@ -33,7 +33,6 @@ namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.Composing typeof(System.Guid).Assembly, typeof(NUnit.Framework.Assert).Assembly, typeof(System.Xml.NameTable).Assembly, - typeof(System.Configuration.GenericEnumConverter).Assembly, typeof(TypeFinder).Assembly, }; diff --git a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Composing/TypeLoaderTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Composing/TypeLoaderTests.cs index cea18c5176..c71d89856e 100644 --- a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Composing/TypeLoaderTests.cs +++ b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Composing/TypeLoaderTests.cs @@ -40,7 +40,6 @@ namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.Composing typeof(Guid).Assembly, typeof(Assert).Assembly, typeof(System.Xml.NameTable).Assembly, - typeof(System.Configuration.GenericEnumConverter).Assembly, ////typeof(TabPage).Assembly, typeof(TypeFinder).Assembly, typeof(UmbracoContext).Assembly, From f351cc15d5e0d7f2f6f1b38f47c2dde04ebd1e51 Mon Sep 17 00:00:00 2001 From: Warren Buckley Date: Wed, 11 Aug 2021 13:33:53 +0100 Subject: [PATCH 5/6] Fix up TestData to not use ConfigManager but to get Version from injected IUmbracoVersion in the view --- src/Umbraco.TestData/LoadTestController.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.TestData/LoadTestController.cs b/src/Umbraco.TestData/LoadTestController.cs index 3033d2febb..6b8bec49e9 100644 --- a/src/Umbraco.TestData/LoadTestController.cs +++ b/src/Umbraco.TestData/LoadTestController.cs @@ -44,7 +44,7 @@ namespace Umbraco.TestData

LoadTest

-
" + System.Configuration.ConfigurationManager.AppSettings["umbracoConfigurationStatus"] + @"
+
@_umbracoVersion.SemanticVersion
"; @@ -53,13 +53,14 @@ namespace Umbraco.TestData private static readonly string s_containerTemplateText = @" @inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage +@inject Umbraco.Cms.Core.Configuration.IUmbracoVersion _umbracoVersion @{ Layout = null; var container = Umbraco.ContentAtRoot().OfTypes(""" + ContainerAlias + @""").FirstOrDefault(); var contents = container.Children().ToArray(); var groups = contents.GroupBy(x => x.Value(""origin"")); var id = contents.Length > 0 ? contents[0].Id : -1; - var wurl = Request.QueryString[""u""] == ""1""; + var wurl = Context.Request.Query[""u""] == ""1""; var missing = contents.Length > 0 && contents[contents.Length - 1].Id - contents[0].Id >= contents.Length; } " + s_headHtml + @" @@ -81,7 +82,7 @@ namespace Umbraco.TestData } if (wurl) { -
@content.Id :: @content.Name :: @content.Url
+
@content.Id :: @content.Name :: @content.Url()
} else { @@ -178,7 +179,7 @@ namespace Umbraco.TestData } } - private IActionResult ContentHtml(string s) => Content(s_headHtml + s + FootHtml); + private IActionResult ContentHtml(string s) => Content(s_headHtml + s + FootHtml, "text/html"); public IActionResult Install() { From f794f638842d8fdf4ee2b1b2792075a1da45f012 Mon Sep 17 00:00:00 2001 From: Warren Buckley Date: Wed, 11 Aug 2021 14:20:58 +0100 Subject: [PATCH 6/6] Use ToSemanticStringWithoutBuild() extension method --- src/Umbraco.TestData/LoadTestController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.TestData/LoadTestController.cs b/src/Umbraco.TestData/LoadTestController.cs index 6b8bec49e9..c245aae816 100644 --- a/src/Umbraco.TestData/LoadTestController.cs +++ b/src/Umbraco.TestData/LoadTestController.cs @@ -44,7 +44,7 @@ namespace Umbraco.TestData

LoadTest

-
@_umbracoVersion.SemanticVersion
+
@_umbracoVersion.SemanticVersion.ToSemanticStringWithoutBuild()
";