Copied to clipboard

Flag this post as spam?

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


  • Simon Justesen 74 posts 193 karma points
    Mar 04, 2017 @ 10:56
    Simon Justesen
    0

    [umb4] Safest way to delete a gazillion recycle bin nodes

    Take a trip down memory lane with me :) I'm maintaining an old Umbraco 4.11.10 site - (that will be updated to v7 in near future, I hope) - and I need to clean the recycle bin as it features a gazillion items (the owner forgot to clean it regularily).

    Cleaning it by the UI seems to take forever, and I cannot track the progress, as the counter doesn't update, so I'm looking for alternative solutions

    I found some old sql statements that could do the trick, and it seems to work in my testing environment, but I am a bit worried about breaking any (future) table references to other places in the database that I'm unaware of.

    Would you rather do it via the API? To me it seems to be the safest bet, but if there's a foolproof SQL statement somewhere, I'm all ears ;)

  • Paul Wright (suedeapple) 277 posts 704 karma points
    Mar 04, 2017 @ 14:21
    Paul Wright (suedeapple)
    0

    If you're moving to V7, just transfer over the "LIVE NODES". Dont worry about your OCD to keep things tidy in v4 :-)

    I used http://soetemansoftware.nl/cmsimport to transfer nodes from a v4 site, to a new v7 site. Was quite straightforward.

  • Simon Justesen 74 posts 193 karma points
    Mar 05, 2017 @ 23:03
    Simon Justesen
    0

    Hi Paul,

    Thanks for your reply ... Haha! I'm not sure if I'm going to be the one, who's actually going to do the site upgrade, but I have to keep this old lady alive and kicking (there can't be many version 4 sites live at this point) until it happens, and that involves a bit of housecleaning :D

    But yeah, I'll definitely look into doing the upgrade using CMSImport, it has helped me before.

    Simon :)

  • Paul Wright (suedeapple) 277 posts 704 karma points
    Mar 06, 2017 @ 00:04
    Paul Wright (suedeapple)
    0

    Maybe you could 'package up' the live content and plonk it into a fresh version of a v4 install.

    Or just get 10,000 monkeys to delete the trashed items one by one.

  • Paul Wright (suedeapple) 277 posts 704 karma points
    Mar 06, 2017 @ 00:08
    Paul Wright (suedeapple)
    100

    Or you could set a scheduled task to run every few mins and delete x-amount of trashed items. Leave it running over night.

    Use the umbraco config, to set the schedule task

  • Simon Justesen 74 posts 193 karma points
    Mar 13, 2017 @ 13:05
    Simon Justesen
    0

    Thanks Paul,

    I'm marking your response as a solution as it is perfectly possible in the way you describe. But I went for the 10,000 monkeys ... What a mess, haha ..

    No, I found this script elsewhere in the forum, which worked perfectly for my purpose. I would however - for future reference - not recommend firing SQL statements directly at the Umbraco database (but it is way faster :P), without some testing beforehand and afterwards

      -- Delete all 'related' nodes and table contents...
    DELETE FROM cmsPreviewXml WHERE nodeId IN (SELECT id FROM umbracoNode WHERE path LIKE '%-20%' AND id != -20);
    DELETE FROM cmsContentVersion WHERE contentId IN (SELECT id FROM umbracoNode WHERE path LIKE '%-20%' AND id != -20);
    DELETE FROM cmsDocument WHERE nodeId IN (SELECT id FROM umbracoNode WHERE path LIKE '%-20%' AND id != -20);
    DELETE FROM cmsContentXML WHERE nodeId IN (SELECT id FROM umbracoNode WHERE path LIKE '%-20%' AND id != -20);
    DELETE FROM cmsContent WHERE nodeId IN (SELECT id FROM umbracoNode WHERE path LIKE '%-20%' AND id != -20);
    DELETE FROM cmsPropertyData WHERE contentNodeId IN (SELECT id FROM umbracoNode WHERE path LIKE '%-20%' AND id != -20);
    DELETE FROM umbracoUser2NodePermission WHERE nodeId IN (SELECT id FROM umbracoNode WHERE path LIKE '%-20%' AND id != -20);
    
    -- delete the XML nodes...
    DELETE FROM umbracoNode WHERE path LIKE '%-20%' AND id != -20;
    
  • Paul Wright (suedeapple) 277 posts 704 karma points
    Mar 13, 2017 @ 13:22
    Paul Wright (suedeapple)
    0

    I assume a "final final" step, would be to rebuild the Examine Index? - Just for good house keeping?

    Good you found faith in the DB approach.

Please Sign in or register to post replies

Write your reply to:

Draft