Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Avraham Kahana 22 posts 56 karma points
    Jun 02, 2015 @ 11:50
    Avraham Kahana
    0

    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?

  • Alex Skrypnyk 6133 posts 23952 karma points MVP 7x admin c-trib
    Jun 02, 2015 @ 14:21
    Alex Skrypnyk
    0

    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

  • Steven Harland 78 posts 518 karma points c-trib
    Jun 02, 2015 @ 17:39
    Steven Harland
    0

    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.

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Jun 03, 2015 @ 08:11
    Dave Woestenborghs
    0

    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

Please Sign in or register to post replies

Write your reply to:

Draft