Web.Routing - cleanup PublishedContentRequest
This commit is contained in:
@@ -37,7 +37,7 @@ namespace Umbraco.Tests.Routing
|
||||
var result = lookup.TryFindDocument(docRequest);
|
||||
|
||||
Assert.IsTrue(result);
|
||||
Assert.AreEqual(docRequest.PublishedContentId, nodeMatch);
|
||||
Assert.AreEqual(docRequest.PublishedContent.Id, nodeMatch);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ namespace Umbraco.Tests.Routing
|
||||
var result = lookup.TryFindDocument(docRequest);
|
||||
|
||||
Assert.IsTrue(result);
|
||||
Assert.AreEqual(docRequest.PublishedContentId, nodeMatch);
|
||||
Assert.AreEqual(docRequest.PublishedContent.Id, nodeMatch);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,7 +48,7 @@ namespace Umbraco.Tests.Routing
|
||||
if (expectedId > 0)
|
||||
{
|
||||
Assert.IsTrue(result);
|
||||
Assert.AreEqual(expectedId, docreq.PublishedContentId);
|
||||
Assert.AreEqual(expectedId, docreq.PublishedContent.Id);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -73,7 +73,7 @@ namespace Umbraco.Tests.Routing
|
||||
var result = lookup.TryFindDocument(docreq);
|
||||
|
||||
Assert.IsTrue(result);
|
||||
Assert.AreEqual(expectedId, docreq.PublishedContentId);
|
||||
Assert.AreEqual(expectedId, docreq.PublishedContent.Id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ namespace Umbraco.Tests.Routing
|
||||
var lookup = new ContentFinderByNiceUrl();
|
||||
var result = lookup.TryFindDocument(pcr);
|
||||
Assert.IsTrue(result);
|
||||
Assert.AreEqual(expectedId, pcr.PublishedContentId);
|
||||
Assert.AreEqual(expectedId, pcr.PublishedContent.Id);
|
||||
}
|
||||
|
||||
[TestCase("http://domain1.com/", 1001, "en-US")]
|
||||
@@ -205,7 +205,7 @@ namespace Umbraco.Tests.Routing
|
||||
var lookup = new ContentFinderByNiceUrl();
|
||||
var result = lookup.TryFindDocument(pcr);
|
||||
Assert.IsTrue(result);
|
||||
Assert.AreEqual(expectedId, pcr.PublishedContentId);
|
||||
Assert.AreEqual(expectedId, pcr.PublishedContent.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Umbraco.Tests.Routing
|
||||
var result = lookup.TryFindDocument(docRequest);
|
||||
|
||||
Assert.IsTrue(result);
|
||||
Assert.AreEqual(docRequest.PublishedContentId, nodeMatch);
|
||||
Assert.AreEqual(docRequest.PublishedContent.Id, nodeMatch);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,7 @@ namespace Umbraco.Tests.Routing
|
||||
var lookup = new ContentFinderByNiceUrl();
|
||||
var result = lookup.TryFindDocument(pcr);
|
||||
Assert.IsTrue(result);
|
||||
Assert.AreEqual(100111, pcr.PublishedContentId);
|
||||
Assert.AreEqual(100111, pcr.PublishedContent.Id);
|
||||
|
||||
// has the cache been polluted?
|
||||
cachedRoutes = ((DefaultRoutesCache)routingContext.UmbracoContext.RoutesCache).GetCachedRoutes();
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Umbraco.Web.Routing
|
||||
if (node != null)
|
||||
{
|
||||
docRequest.PublishedContent = node;
|
||||
LogHelper.Debug<ContentFinderByIdPath>("Found node with id={0}", () => docRequest.PublishedContentId);
|
||||
LogHelper.Debug<ContentFinderByIdPath>("Found node with id={0}", () => docRequest.PublishedContent.Id);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace Umbraco.Web.Routing
|
||||
if (node != null)
|
||||
{
|
||||
docreq.PublishedContent = node;
|
||||
LogHelper.Debug<ContentFinderByNiceUrl>("Query matches, id={0}", () => docreq.PublishedContentId);
|
||||
LogHelper.Debug<ContentFinderByNiceUrl>("Query matches, id={0}", () => docreq.PublishedContent.Id);
|
||||
|
||||
var iscanon = !DomainHelper.ExistsDomainInPath(docreq.Domain, node.Path);
|
||||
if (!iscanon)
|
||||
@@ -87,7 +87,7 @@ namespace Umbraco.Web.Routing
|
||||
|
||||
// do not store if previewing or if non-canonical
|
||||
if (!docreq.RoutingContext.UmbracoContext.InPreviewMode && iscanon)
|
||||
docreq.RoutingContext.UmbracoContext.RoutesCache.Store(docreq.PublishedContentId, route);
|
||||
docreq.RoutingContext.UmbracoContext.RoutesCache.Store(docreq.PublishedContent.Id, route);
|
||||
|
||||
}
|
||||
else
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Umbraco.Web.Routing
|
||||
if (node != null)
|
||||
{
|
||||
docRequest.PublishedContent = node;
|
||||
LogHelper.Debug<ContentFinderByUrlAlias>("Path \"{0}\" is an alias for id={1}", () => docRequest.Uri.AbsolutePath, () => docRequest.PublishedContentId);
|
||||
LogHelper.Debug<ContentFinderByUrlAlias>("Path \"{0}\" is an alias for id={1}", () => docRequest.Uri.AbsolutePath, () => docRequest.PublishedContent.Id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -145,20 +145,6 @@ namespace Umbraco.Web.Routing
|
||||
set { _initialPublishedContent = _publishedContent; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the identifier of the requested content.
|
||||
/// </summary>
|
||||
/// <exception cref="InvalidOperationException">Thrown when the content request has no content.</exception>
|
||||
public int PublishedContentId
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.PublishedContent == null)
|
||||
throw new InvalidOperationException("PublishedContentRequest has no document.");
|
||||
return _publishedContentId;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the content request has a content.
|
||||
/// </summary>
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace Umbraco.Web.Routing
|
||||
_pcr.UmbracoPage = new page(_pcr);
|
||||
|
||||
// these two are used by many legacy objects
|
||||
_routingContext.UmbracoContext.HttpContext.Items["pageID"] = _pcr.PublishedContentId;
|
||||
_routingContext.UmbracoContext.HttpContext.Items["pageID"] = _pcr.PublishedContent.Id;
|
||||
_routingContext.UmbracoContext.HttpContext.Items["pageElements"] = _pcr.UmbracoPage.Elements;
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ namespace Umbraco.Web.Routing
|
||||
_pcr.UmbracoPage = new page(_pcr);
|
||||
|
||||
// these two are used by many legacy objects
|
||||
_routingContext.UmbracoContext.HttpContext.Items["pageID"] = _pcr.PublishedContentId;
|
||||
_routingContext.UmbracoContext.HttpContext.Items["pageID"] = _pcr.PublishedContent.Id;
|
||||
_routingContext.UmbracoContext.HttpContext.Items["pageElements"] = _pcr.UmbracoPage.Elements;
|
||||
}
|
||||
|
||||
@@ -455,7 +455,7 @@ namespace Umbraco.Web.Routing
|
||||
//_pcr.Document = null; // no! that would be to force a 404
|
||||
LogHelper.Debug<PublishedContentRequestEngine>("{0}Failed to redirect to id={1}: invalid value", () => tracePrefix, () => internalRedirect);
|
||||
}
|
||||
else if (internalRedirectId == _pcr.PublishedContentId)
|
||||
else if (internalRedirectId == _pcr.PublishedContent.Id)
|
||||
{
|
||||
// redirect to self
|
||||
LogHelper.Debug<PublishedContentRequestEngine>("{0}Redirecting to self, ignore", () => tracePrefix);
|
||||
@@ -494,7 +494,7 @@ namespace Umbraco.Web.Routing
|
||||
|
||||
var path = _pcr.PublishedContent.Path;
|
||||
|
||||
if (Access.IsProtected(_pcr.PublishedContentId, path))
|
||||
if (Access.IsProtected(_pcr.PublishedContent.Id, path))
|
||||
{
|
||||
LogHelper.Debug<PublishedContentRequestEngine>("{0}Page is protected, check for access", () => tracePrefix);
|
||||
|
||||
@@ -512,14 +512,14 @@ namespace Umbraco.Web.Routing
|
||||
{
|
||||
LogHelper.Debug<PublishedContentRequestEngine>("{0}Not logged in, redirect to login page", () => tracePrefix);
|
||||
var loginPageId = Access.GetLoginPage(path);
|
||||
if (loginPageId != _pcr.PublishedContentId)
|
||||
if (loginPageId != _pcr.PublishedContent.Id)
|
||||
_pcr.PublishedContent = _routingContext.PublishedContentStore.GetDocumentById(_routingContext.UmbracoContext, loginPageId);
|
||||
}
|
||||
else if (!Access.HasAccces(_pcr.PublishedContentId, user.ProviderUserKey))
|
||||
else if (!Access.HasAccces(_pcr.PublishedContent.Id, user.ProviderUserKey))
|
||||
{
|
||||
LogHelper.Debug<PublishedContentRequestEngine>("{0}Current member has not access, redirect to error page", () => tracePrefix);
|
||||
var errorPageId = Access.GetErrorPage(path);
|
||||
if (errorPageId != _pcr.PublishedContentId)
|
||||
if (errorPageId != _pcr.PublishedContent.Id)
|
||||
_pcr.PublishedContent = _routingContext.PublishedContentStore.GetDocumentById(_routingContext.UmbracoContext, errorPageId);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -168,7 +168,7 @@ namespace Umbraco.Web.Templates
|
||||
// handlers like default.aspx will want it and most macros currently need it
|
||||
contentRequest.UmbracoPage = new page(contentRequest);
|
||||
//now, set the new ones for this page execution
|
||||
_umbracoContext.HttpContext.Items["pageID"] = contentRequest.PublishedContentId;
|
||||
_umbracoContext.HttpContext.Items["pageID"] = contentRequest.PublishedContent.Id;
|
||||
_umbracoContext.HttpContext.Items["pageElements"] = contentRequest.UmbracoPage.Elements;
|
||||
_umbracoContext.HttpContext.Items["altTemplate"] = null;
|
||||
_umbracoContext.PublishedContentRequest = contentRequest;
|
||||
|
||||
@@ -213,7 +213,7 @@ namespace umbraco
|
||||
// partially prepare the request: do _not_ follow redirects, handle 404, nothing - just find a content
|
||||
pcr.Engine.FindDomain();
|
||||
pcr.Engine.FindPublishedContent();
|
||||
return pcr.HasPublishedContent ? pcr.PublishedContentId : uQuery.RootNodeId;
|
||||
return pcr.HasPublishedContent ? pcr.PublishedContent.Id : uQuery.RootNodeId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user