public bool TryRemoveItemData(ID itemId, bool recurse = false) { using (var transaction = HeadProviderEx.OpenTransaction()) { using (new SecurityDisabler()) { var result = TryRemoveItemDataInner(itemId, recurse); transaction.Complete(); return(result); } } }
private ID ResolveHeadPath(ID parentId, string[] pathSegments, int segmentIndex, CallContext context) { if (segmentIndex >= pathSegments.Length) { return(parentId); } var segmentName = pathSegments[segmentIndex]; var children = HeadProviderEx.GetChildIdsByName(segmentName, parentId); foreach (var childId in children) { var pathId = ResolveHeadPath(childId, pathSegments, segmentIndex + 1, context); if (pathId != (ID)null) { return(pathId); } } return(null); }
private bool TryRemoveItemDataInner(ID itemId, bool recurse) { var itemDefinition = new ItemDefinition(itemId, string.Empty, ID.Undefined, ID.Undefined); var childrenIds = recurse ? GetChildrenIds(itemDefinition) : new ID[0]; var result = false; if (CanBeRemovedFromHead(itemId)) { HeadProviderEx.RemoveItemData(itemId); Database.RemoveFromCaches(itemId); result = true; } foreach (var childId in childrenIds) { result |= TryRemoveItemDataInner(childId, recurse); } return(result); }