Fixes merge issues

This commit is contained in:
Shannon
2013-10-28 11:38:07 +11:00
parent fea90482b6
commit 660e89a46c
3 changed files with 40 additions and 5 deletions

View File

@@ -7,6 +7,7 @@ using System.Web.Mvc;
using System.Web.Routing;
using System.Xml;
using NUnit.Framework;
using Umbraco.Web.Security;
using umbraco.BusinessLogic;
using Umbraco.Core;
using Umbraco.Core.Models;
@@ -402,12 +403,13 @@ namespace Umbraco.Tests.Mvc
//PublishedContentCache.UnitTesting = true;
// ApplicationContext.Current = new ApplicationContext(false) { IsReady = true };
var appCtx = new ApplicationContext(false) { IsReady = true };
var appCtx = new ApplicationContext(CacheHelper.CreateDisabledCacheHelper()) { IsReady = true };
var http = GetHttpContextFactory(url, routeData).HttpContext;
var ctx = new UmbracoContext(
GetHttpContextFactory(url, routeData).HttpContext,
appCtx,
new PublishedCaches(cache, new PublishedMediaCache()));
new PublishedCaches(cache, new PublishedMediaCache()),
new WebSecurity(http, appCtx));
//if (setSingleton)
//{

View File

@@ -81,7 +81,7 @@ namespace Umbraco.Web.Standalone
base.FreezeResolution();
var httpContext = new StandaloneHttpContext();
UmbracoContext.EnsureContext(httpContext, ApplicationContext.Current, false, false);
UmbracoContext.EnsureContext(httpContext, ApplicationContext.Current, new WebSecurity(httpContext, ApplicationContext.Current), false, false);
}
}
}

View File

@@ -132,6 +132,38 @@ namespace Umbraco.Web
ApplicationContext applicationContext,
WebSecurity webSecurity,
bool replaceContext)
{
return EnsureContext(httpContext, applicationContext, new WebSecurity(httpContext, applicationContext), replaceContext, null);
}
/// <summary>
/// This is a helper method which is called to ensure that the singleton context is created and the nice url and routing
/// context is created and assigned.
/// </summary>
/// <param name="httpContext"></param>
/// <param name="applicationContext"></param>
/// <param name="webSecurity"></param>
/// <param name="replaceContext">
/// if set to true will replace the current singleton with a new one, this is generally only ever used because
/// during application startup the base url domain will not be available so after app startup we'll replace the current
/// context with a new one in which we can access the httpcontext.Request object.
/// </param>
/// <param name="preview"></param>
/// <returns>
/// The Singleton context object
/// </returns>
/// <remarks>
/// This is created in order to standardize the creation of the singleton. Normally it is created during a request
/// in the UmbracoModule, however this module does not execute during application startup so we need to ensure it
/// during the startup process as well.
/// See: http://issues.umbraco.org/issue/U4-1890, http://issues.umbraco.org/issue/U4-1717
/// </remarks>
public static UmbracoContext EnsureContext(
HttpContextBase httpContext,
ApplicationContext applicationContext,
WebSecurity webSecurity,
bool replaceContext,
bool? preview)
{
if (UmbracoContext.Current != null)
{
@@ -144,7 +176,8 @@ namespace Umbraco.Web
httpContext,
applicationContext,
PublishedCachesResolver.Current.Caches,
webSecurity);
webSecurity,
preview);
// create the nice urls provider
// there's one per request because there are some behavior parameters that can be changed