NetCore: Refactor config/setting to not use dependencies (#7810)
* Avoid usage of IOHelper in GlobalSettings * Avoid usage of IOHelper in ModelsBuilderConfig.cs * Avoid usage of IOHelper in ConnectionStrings.cs * Simplified more config * Fix for ModelsBuilderConfig * Moved GetUmbracoMvcAreaNoCache to IOHelperExtensions
This commit is contained in:
@@ -6,6 +6,7 @@ using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Exceptions;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Web.Composing;
|
||||
using Umbraco.Web.Routing;
|
||||
@@ -30,26 +31,25 @@ namespace Umbraco.Web
|
||||
/// </remarks>
|
||||
public class UmbracoInjectedModule : IHttpModule
|
||||
{
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly IRuntimeState _runtime;
|
||||
private readonly ILogger _logger;
|
||||
private readonly IPublishedRouter _publishedRouter;
|
||||
private readonly IUmbracoContextFactory _umbracoContextFactory;
|
||||
private readonly RoutableDocumentFilter _routableDocumentLookup;
|
||||
private readonly IRequestCache _requestCache;
|
||||
private readonly IIOHelper _ioHelper;
|
||||
private readonly UriUtility _uriUtility;
|
||||
|
||||
public UmbracoInjectedModule(
|
||||
IGlobalSettings globalSettings,
|
||||
IRuntimeState runtime,
|
||||
ILogger logger,
|
||||
IPublishedRouter publishedRouter,
|
||||
IUmbracoContextFactory umbracoContextFactory,
|
||||
RoutableDocumentFilter routableDocumentLookup,
|
||||
UriUtility uriUtility,
|
||||
IRequestCache requestCache)
|
||||
IRequestCache requestCache,
|
||||
IIOHelper ioHelper)
|
||||
{
|
||||
_globalSettings = globalSettings;
|
||||
_runtime = runtime;
|
||||
_logger = logger;
|
||||
_publishedRouter = publishedRouter;
|
||||
@@ -57,6 +57,7 @@ namespace Umbraco.Web
|
||||
_routableDocumentLookup = routableDocumentLookup;
|
||||
_uriUtility = uriUtility;
|
||||
_requestCache = requestCache;
|
||||
_ioHelper = ioHelper;
|
||||
}
|
||||
|
||||
#region HttpModule event handlers
|
||||
@@ -110,7 +111,7 @@ namespace Umbraco.Web
|
||||
var umbracoContext = Current.UmbracoContext;
|
||||
|
||||
// re-write for the default back office path
|
||||
if (httpContext.Request.Url.IsDefaultBackOfficeRequest(_globalSettings))
|
||||
if (httpContext.Request.Url.IsDefaultBackOfficeRequest(_ioHelper))
|
||||
{
|
||||
if (EnsureRuntime(httpContext, umbracoContext.OriginalRequestUrl))
|
||||
RewriteToBackOfficeHandler(httpContext);
|
||||
@@ -256,7 +257,7 @@ namespace Umbraco.Web
|
||||
private void RewriteToBackOfficeHandler(HttpContextBase context)
|
||||
{
|
||||
// GlobalSettings.Path has already been through IOHelper.ResolveUrl() so it begins with / and vdir (if any)
|
||||
var rewritePath = _globalSettings.Path.TrimEnd('/') + "/Default";
|
||||
var rewritePath = _ioHelper.BackOfficePath.TrimEnd('/') + "/Default";
|
||||
// rewrite the path to the path of the handler (i.e. /umbraco/RenderMvc)
|
||||
context.RewritePath(rewritePath, "", "", false);
|
||||
|
||||
@@ -289,7 +290,7 @@ namespace Umbraco.Web
|
||||
var query = pcr.Uri.Query.TrimStart('?');
|
||||
|
||||
// GlobalSettings.Path has already been through IOHelper.ResolveUrl() so it begins with / and vdir (if any)
|
||||
var rewritePath = _globalSettings.Path.TrimEnd('/') + "/RenderMvc";
|
||||
var rewritePath = _ioHelper.BackOfficePath.TrimEnd('/') + "/RenderMvc";
|
||||
// rewrite the path to the path of the handler (i.e. /umbraco/RenderMvc)
|
||||
context.RewritePath(rewritePath, "", query, false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user