Best way to sweep the content tree for doc type properties that refer to deleted content nodes
I was writing some code to deal with the following issue:
Upon deleting a content node, multi-node-tree picker properties anywhere in umbraco that contained a reference to a deleted content node remain there, undeleted. There is no "cascade" delete in a content node.
So I was trying to handle this via ContentService.Thrashed event.
But in a production environment, with hundreds of content nodes, this might not be something feasible to perform, upon every delete request.
Maybe you can create some task with a schedule for checking Trash and deleting referenced nodes in the background. It will be better for editor, and maybe better for the system.
Instead of using the MNTP you could create relations between these nodes and develop a custom datatype to manage them. The following article describes how this could be done using nuPickers:
When a node is deleted (not trashed however), so are its relations so this may solve your issue.
But if reimplementing your solution isn't an option then Alex's scheduled cleanup task may be the best way to solve this. I'd suggest performing an Examine search to quickly identify the nodes in question before updating them.
Actually i'm working on a package that does exactly this. It will keep track of your linked items and will warn you when you try to unpublish/delete when there are other items linking to it.
It's still in early stages, just need some time to finish it.
Best way to sweep the content tree for doc type properties that refer to deleted content nodes
I was writing some code to deal with the following issue:
Upon deleting a content node, multi-node-tree picker properties anywhere in umbraco that contained a reference to a deleted content node remain there, undeleted. There is no "cascade" delete in a content node.
So I was trying to handle this via ContentService.Thrashed event. But in a production environment, with hundreds of content nodes, this might not be something feasible to perform, upon every delete request.
Is there a fix for this? Is there a better way?
Hi Avraham,
Maybe you can create some task with a schedule for checking Trash and deleting referenced nodes in the background. It will be better for editor, and maybe better for the system.
Thanks, Alex
Hi Avraham,
Instead of using the MNTP you could create relations between these nodes and develop a custom datatype to manage them. The following article describes how this could be done using nuPickers:
http://skrift.io/articles/archive/the-king-is-dead-long-live-the-king/
When a node is deleted (not trashed however), so are its relations so this may solve your issue.
But if reimplementing your solution isn't an option then Alex's scheduled cleanup task may be the best way to solve this. I'd suggest performing an Examine search to quickly identify the nodes in question before updating them.
Hope this helps.
Thanks.
Steven.
Hi all,
Actually i'm working on a package that does exactly this. It will keep track of your linked items and will warn you when you try to unpublish/delete when there are other items linking to it.
It's still in early stages, just need some time to finish it.
Dave
is working on a reply...