diff --git a/src/Umbraco.Abstractions/Cache/MacroCacheRefresher.cs b/src/Umbraco.Abstractions/Cache/MacroCacheRefresher.cs index 40c577444b..0863577487 100644 --- a/src/Umbraco.Abstractions/Cache/MacroCacheRefresher.cs +++ b/src/Umbraco.Abstractions/Cache/MacroCacheRefresher.cs @@ -7,7 +7,7 @@ using Umbraco.Core.Serialization; namespace Umbraco.Web.Cache { - public sealed class MacroCacheRefresher : JsonCacheRefresherBase + public sealed class MacroCacheRefresher : PayloadCacheRefresherBase { public MacroCacheRefresher(AppCaches appCaches, IJsonSerializer jsonSerializer) : base(appCaches, jsonSerializer) diff --git a/src/Umbraco.Abstractions/Cache/MemberGroupCacheRefresher.cs b/src/Umbraco.Abstractions/Cache/MemberGroupCacheRefresher.cs index 1149d499f5..213ca11302 100644 --- a/src/Umbraco.Abstractions/Cache/MemberGroupCacheRefresher.cs +++ b/src/Umbraco.Abstractions/Cache/MemberGroupCacheRefresher.cs @@ -6,7 +6,7 @@ using Umbraco.Core.Serialization; namespace Umbraco.Web.Cache { - public sealed class MemberGroupCacheRefresher : JsonCacheRefresherBase + public sealed class MemberGroupCacheRefresher : PayloadCacheRefresherBase { public MemberGroupCacheRefresher(AppCaches appCaches, IJsonSerializer jsonSerializer) : base(appCaches, jsonSerializer) diff --git a/src/Umbraco.Web/Editors/MacroRenderingController.cs b/src/Umbraco.Web/Editors/MacroRenderingController.cs index 9e9b7efc1b..d96533b165 100644 --- a/src/Umbraco.Web/Editors/MacroRenderingController.cs +++ b/src/Umbraco.Web/Editors/MacroRenderingController.cs @@ -11,8 +11,13 @@ using System.Web.SessionState; using Umbraco.Web.Models.ContentEditing; using Umbraco.Web.Mvc; using Umbraco.Core; +using Umbraco.Core.Cache; +using Umbraco.Core.Configuration; +using Umbraco.Core.Logging; +using Umbraco.Core.Mapping; using Umbraco.Core.Models; using Umbraco.Core.Models.PublishedContent; +using Umbraco.Core.Persistence; using Umbraco.Core.Services; using Umbraco.Core.Strings; @@ -30,18 +35,39 @@ namespace Umbraco.Web.Editors public class MacroRenderingController : UmbracoAuthorizedJsonController, IRequiresSessionState { private readonly IMacroService _macroService; - private readonly IContentService _contentService; - private readonly IShortStringHelper _shortStringHelper; private readonly IUmbracoComponentRenderer _componentRenderer; private readonly IVariationContextAccessor _variationContextAccessor; - public MacroRenderingController(IUmbracoComponentRenderer componentRenderer, IVariationContextAccessor variationContextAccessor, IMacroService macroService, IContentService contentService, IShortStringHelper shortStringHelper) + + public MacroRenderingController( + IGlobalSettings globalSettings, + IUmbracoContextAccessor umbracoContextAccessor, + ISqlContext sqlContext, + ServiceContext services, + AppCaches appCaches, + IProfilingLogger logger, + IRuntimeState runtimeState, + UmbracoHelper umbracoHelper, + IShortStringHelper shortStringHelper, + UmbracoMapper umbracoMapper, + IUmbracoComponentRenderer componentRenderer, + IVariationContextAccessor variationContextAccessor, + IMacroService macroService) + : base( + globalSettings, + umbracoContextAccessor, + sqlContext, + services, + appCaches, + logger, + runtimeState, + umbracoHelper, + shortStringHelper, + umbracoMapper) { _componentRenderer = componentRenderer; _variationContextAccessor = variationContextAccessor; _macroService = macroService; - _contentService = contentService; - _shortStringHelper = shortStringHelper; } /// @@ -162,7 +188,7 @@ namespace Umbraco.Web.Editors var macroName = model.Filename.TrimEnd(".cshtml"); - var macro = new Macro(_shortStringHelper) + var macro = new Macro(ShortStringHelper) { Alias = macroName.ToSafeAlias(ShortStringHelper), Name = macroName, diff --git a/src/Umbraco.Web/Editors/UmbracoAuthorizedJsonController.cs b/src/Umbraco.Web/Editors/UmbracoAuthorizedJsonController.cs index 1a432981c8..fb4fd929f8 100644 --- a/src/Umbraco.Web/Editors/UmbracoAuthorizedJsonController.cs +++ b/src/Umbraco.Web/Editors/UmbracoAuthorizedJsonController.cs @@ -7,6 +7,7 @@ using Umbraco.Core.Mapping; using Umbraco.Core.Persistence; using Umbraco.Core.Services; using Umbraco.Core.Strings; +using Umbraco.Web.Composing; using Umbraco.Web.WebApi; using Umbraco.Web.WebApi.Filters; @@ -25,6 +26,7 @@ namespace Umbraco.Web.Editors { protected UmbracoAuthorizedJsonController() { + ShortStringHelper = Current.ShortStringHelper; } protected UmbracoAuthorizedJsonController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper, IShortStringHelper shortStringHelper, UmbracoMapper umbracoMapper) diff --git a/src/Umbraco.Web/Install/InstallSteps/StarterKitInstallStep.cs b/src/Umbraco.Web/Install/InstallSteps/StarterKitInstallStep.cs index 539b261cf3..37e514b370 100644 --- a/src/Umbraco.Web/Install/InstallSteps/StarterKitInstallStep.cs +++ b/src/Umbraco.Web/Install/InstallSteps/StarterKitInstallStep.cs @@ -14,13 +14,13 @@ namespace Umbraco.Web.Install.InstallSteps PerformsAppRestart = true)] internal class StarterKitInstallStep : InstallSetupStep { - private readonly HttpContextBase _httContext; + private readonly IHttpContextAccessor _httContextAccessor; private readonly IUmbracoContextAccessor _umbracoContextAccessor; private readonly IPackagingService _packagingService; - public StarterKitInstallStep(HttpContextBase httContext, IUmbracoContextAccessor umbracoContextAccessor, IPackagingService packagingService) + public StarterKitInstallStep(IHttpContextAccessor httContextAccessor, IUmbracoContextAccessor umbracoContextAccessor, IPackagingService packagingService) { - _httContext = httContext; + _httContextAccessor = httContextAccessor; _umbracoContextAccessor = umbracoContextAccessor; _packagingService = packagingService; } @@ -34,7 +34,7 @@ namespace Umbraco.Web.Install.InstallSteps InstallBusinessLogic(packageId); - UmbracoApplication.Restart(_httContext); + UmbracoApplication.Restart(_httContextAccessor.HttpContext); return Task.FromResult(null); } diff --git a/src/Umbraco.Web/Routing/PublishedRequest.cs b/src/Umbraco.Web/Routing/PublishedRequest.cs index b1337f3b87..86bca12ef9 100644 --- a/src/Umbraco.Web/Routing/PublishedRequest.cs +++ b/src/Umbraco.Web/Routing/PublishedRequest.cs @@ -30,7 +30,6 @@ namespace Umbraco.Web.Routing private CultureInfo _culture; private IPublishedContent _publishedContent; private IPublishedContent _initialPublishedContent; // found by finders before 404, redirects, etc - private PublishedContentHashtableConverter _umbracoPage; // legacy /// /// Initializes a new instance of the class. @@ -480,23 +479,5 @@ namespace Umbraco.Web.Routing public Dictionary Headers { get; set; } = new Dictionary(); #endregion - - #region Legacy - - // for legacy/webforms/macro code - - // TODO: get rid of it eventually - public PublishedContentHashtableConverter LegacyContentHashTable - { - get - { - if (_umbracoPage == null) - throw new InvalidOperationException("The UmbracoPage object has not been initialized yet."); - - return _umbracoPage; - } - set => _umbracoPage = value; - } - - #endregion } } diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index a2db94f9a5..d6a8704510 100755 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -165,6 +165,7 @@ + @@ -697,9 +698,6 @@ Code - - Code -