Fixes issue with nucache and rebuilding and fixes ChildrenForAllCultures to deal with unpublished children

This commit is contained in:
Shannon
2019-06-18 11:57:36 +10:00
parent 7c11943836
commit fecadeec51
2 changed files with 58 additions and 6 deletions

View File

@@ -647,9 +647,16 @@ namespace Umbraco.Web.PublishedCache.NuCache
var id = content.FirstChildContentId;
while (id > 0)
{
var link = GetLinkedNode(id, "child");
ClearBranchLocked(link.Value);
id = link.Value.NextSiblingContentId;
if (TryGetLinkedNode(id, out var link))
{
ClearBranchLocked(link.Value);
id = link.Value.NextSiblingContentId;
}
else
{
// break i guess?
id = 0;
}
}
}
@@ -663,6 +670,18 @@ namespace Umbraco.Web.PublishedCache.NuCache
throw new Exception($"panic: failed to get {description} with id={id}");
}
private bool TryGetLinkedNode(int id, out LinkedNode<ContentNode> node)
{
if (_contentNodes.TryGetValue(id, out var link) && link.Value != null)
{
node = link;
return true;
}
node = null;
return false;
}
private LinkedNode<ContentNode> GetParentLink(ContentNode content)
{
_contentNodes.TryGetValue(content.ParentContentId, out var link); // else null