From cd4f646ed03df8c6aa9da305e79e33ee1c9042ea Mon Sep 17 00:00:00 2001 From: Benjamin Carleski Date: Mon, 20 Jan 2020 11:45:44 -0800 Subject: [PATCH] Remove obsolete PublishedContentQuery constructor --- .../PublishedContent/PublishedContentMoreTests.cs | 5 ++++- src/Umbraco.Web/PublishedContentQuery.cs | 6 ------ src/Umbraco.Web/Routing/ContentFinderByConfigured404.cs | 7 +++++-- src/Umbraco.Web/Runtime/WebInitialComposer.cs | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentMoreTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentMoreTests.cs index a87e3cff8f..db5e59c9c0 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedContentMoreTests.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedContentMoreTests.cs @@ -7,6 +7,8 @@ using Umbraco.Web; using Umbraco.Core; using Umbraco.Tests.Testing; using Umbraco.Web.Composing; +using Moq; +using Examine; namespace Umbraco.Tests.PublishedContent { @@ -201,7 +203,8 @@ namespace Umbraco.Tests.PublishedContent [Test] public void PublishedContentQueryTypedContentList() { - var query = new PublishedContentQuery(Current.UmbracoContext.PublishedSnapshot, Current.UmbracoContext.VariationContextAccessor); + var examineManager = new Mock(); + var query = new PublishedContentQuery(Current.UmbracoContext.PublishedSnapshot, Current.UmbracoContext.VariationContextAccessor, examineManager.Object); var result = query.Content(new[] { 1, 2, 4 }).ToArray(); Assert.AreEqual(2, result.Length); Assert.AreEqual(1, result[0].Id); diff --git a/src/Umbraco.Web/PublishedContentQuery.cs b/src/Umbraco.Web/PublishedContentQuery.cs index 2dbe4de4c5..1574ac499e 100644 --- a/src/Umbraco.Web/PublishedContentQuery.cs +++ b/src/Umbraco.Web/PublishedContentQuery.cs @@ -22,12 +22,6 @@ namespace Umbraco.Web private readonly IVariationContextAccessor _variationContextAccessor; private readonly IExamineManager _examineManager; - [Obsolete("Use the constructor with all parameters instead")] - public PublishedContentQuery(IPublishedSnapshot publishedSnapshot, IVariationContextAccessor variationContextAccessor) - : this (publishedSnapshot, variationContextAccessor, ExamineManager.Instance) - { - } - /// /// Initializes a new instance of the class. /// diff --git a/src/Umbraco.Web/Routing/ContentFinderByConfigured404.cs b/src/Umbraco.Web/Routing/ContentFinderByConfigured404.cs index eae198bb59..7dc8203d40 100644 --- a/src/Umbraco.Web/Routing/ContentFinderByConfigured404.cs +++ b/src/Umbraco.Web/Routing/ContentFinderByConfigured404.cs @@ -1,3 +1,4 @@ +using Examine; using System.Globalization; using System.Linq; using Umbraco.Core; @@ -16,12 +17,14 @@ namespace Umbraco.Web.Routing private readonly ILogger _logger; private readonly IEntityService _entityService; private readonly IContentSection _contentConfigSection; + private readonly IExamineManager _examineManager; - public ContentFinderByConfigured404(ILogger logger, IEntityService entityService, IContentSection contentConfigSection) + public ContentFinderByConfigured404(ILogger logger, IEntityService entityService, IContentSection contentConfigSection, IExamineManager examineManager) { _logger = logger; _entityService = entityService; _contentConfigSection = contentConfigSection; + _examineManager = examineManager; } /// @@ -62,7 +65,7 @@ namespace Umbraco.Web.Routing var error404 = NotFoundHandlerHelper.GetCurrentNotFoundPageId( _contentConfigSection.Error404Collection.ToArray(), _entityService, - new PublishedContentQuery(frequest.UmbracoContext.PublishedSnapshot, frequest.UmbracoContext.VariationContextAccessor), + new PublishedContentQuery(frequest.UmbracoContext.PublishedSnapshot, frequest.UmbracoContext.VariationContextAccessor, _examineManager), errorCulture); IPublishedContent content = null; diff --git a/src/Umbraco.Web/Runtime/WebInitialComposer.cs b/src/Umbraco.Web/Runtime/WebInitialComposer.cs index 0c87ac78cb..e2d2e59157 100644 --- a/src/Umbraco.Web/Runtime/WebInitialComposer.cs +++ b/src/Umbraco.Web/Runtime/WebInitialComposer.cs @@ -106,7 +106,7 @@ namespace Umbraco.Web.Runtime composition.Register(factory => { var umbCtx = factory.GetInstance(); - return new PublishedContentQuery(umbCtx.UmbracoContext.PublishedSnapshot, factory.GetInstance()); + return new PublishedContentQuery(umbCtx.UmbracoContext.PublishedSnapshot, factory.GetInstance(), factory.GetInstance()); }, Lifetime.Request); composition.Register(Lifetime.Request);