Copied to clipboard

Flag this post as spam?

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


  • Anders Brohus 193 posts 474 karma points
    Jul 31, 2017 @ 09:18
    Anders Brohus
    0

    Unable to empty recycle bin

    Hi our! :)

    Currently got a problem where i can't empty my recycle bin, it just gives me an "Timeout error" with "500 (Internal Server Error)"

    The site did run Umbraco 7.5.6 so i tried to upgrade to Umbraco 7.5.14, but it didn't help.

    It's both content and media recycle bin that i can't empty.

    I'm trying to empty those since the database is using 2.2GB, and i have UnVersion installed :)

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    Jul 31, 2017 @ 11:54
    Alex Skrypnyk
    100

    Hi Anders

    Maybe it will help you, really nice SQL query for clearing Umbraco database, it can reduce size drastically:

    https://gist.github.com/dampee/a8ead728165b16d49c00

    Thanks,

    Alex

  • Anders Brohus 193 posts 474 karma points
    Jul 31, 2017 @ 12:41
    Anders Brohus
    0

    Hi Alex,

    Thanks for your time! :)

    I will try run that script, currently i have tried this one,

    https://gist.github.com/genckastrati/0e7f7ae6156647e00a56eb5ef403166d

    But it didn't allowed me to empty the recycle bins :(

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    Jul 31, 2017 @ 14:16
    Alex Skrypnyk
    0

    You are welcome, also can you check what is timeout for sql server operations?

    Try to check it with MSSQL management studio.enter image description here

    Hope it will help,

    Alex

  • GiuServ 4 posts 75 karma points
    Jan 04, 2018 @ 11:16
    GiuServ
    2

    For umbraco 7+ (currently last release 7.7.7) i made this script to empty both media and document recycle bin:

    DELETE FROM cmsPreviewXml WHERE  nodeId IN (SELECT id FROM umbracoNode WHERE (path LIKE '%-21%' AND id!=-21) OR (path LIKE '%-20%' AND id!=-20));
    DELETE FROM cmsContentVersion WHERE  ContentId IN (SELECT id FROM umbracoNode WHERE (path LIKE '%-21%' AND id!=-21) OR (path LIKE '%-20%' AND id!=-20));
    DELETE FROM cmsDocument WHERE nodeId IN (SELECT id FROM umbracoNode WHERE (path LIKE '%-21%' AND id!=-21) OR (path LIKE '%-20%' AND id!=-20));
    DELETE FROM cmsTagRelationship WHERE nodeId IN (SELECT id FROM umbracoNode WHERE (path LIKE '%-21%' AND id!=-21) OR (path LIKE '%-20%' AND id!=-20));
    DELETE FROM cmsContentXML WHERE nodeId IN (SELECT id FROM umbracoNode WHERE (path LIKE '%-21%' AND id!=-21) OR (path LIKE '%-20%' AND id!=-20));
    DELETE FROM cmsContent WHERE nodeId IN (SELECT id FROM umbracoNode WHERE (path LIKE '%-21%' AND id!=-21) OR (path LIKE '%-20%' AND id!=-20));
    DELETE FROM cmsPropertyData WHERE contentNodeId IN (SELECT id FROM umbracoNode WHERE (path LIKE '%-21%' AND id!=-21) OR (path LIKE '%-20%' AND id!=-20));
    DELETE FROM umbracoDomains WHERE domainRootStructureID IN (SELECT id FROM umbracoNode WHERE (path LIKE '%-21%' AND id!=-21) OR (path LIKE '%-20%' AND id!=-20));
    DELETE FROM umbracoUser2NodePermission WHERE nodeId IN (SELECT id FROM umbracoNode WHERE (path LIKE '%-21%' AND id!=-21) OR (path LIKE '%-20%' AND id!=-20));
    DELETE FROM umbracorelation WHERE parentId IN (SELECT id FROM umbracoNode WHERE (path LIKE '%-21%' AND id!=-21) OR (path LIKE '%-20%' AND id!=-20));
    DELETE FROM umbracorelation WHERE childId IN (SELECT id FROM umbracoNode WHERE (path LIKE '%-21%' AND id!=-21) OR (path LIKE '%-20%' AND id!=-20));
    DELETE FROM umbracoredirecturl WHERE contentKey IN (SELECT uniqueID FROM umbracoNode WHERE (path LIKE '%-21%' AND id!=-21) OR (path LIKE '%-20%' AND id!=-20));
    ALTER TABLE `umbraconode` DROP FOREIGN KEY `umbraconode_ibfk_1`; 
    DELETE FROM umbracoNode WHERE (path LIKE '%-21%' AND id!=-21) OR (path LIKE '%-20%' AND id!=-20);
    ALTER TABLE `umbraconode` ADD CONSTRAINT `umbraconode_ibfk_1` FOREIGN KEY (`parentID`) REFERENCES `umbraconode`(`id`);
    

    Backup your DB before trying it.

  • Markus Johansson 1701 posts 4879 karma points c-trib
    Dec 06, 2018 @ 11:40
    Markus Johansson
    0

    Thanks for sharing this!

    I noticed some errors related to cmsContent what was about to be deleted but had a foreign key constrain to a media item, after emptying the media recycle bin from the backoffice this code worked great on Umbraco v7.12.3.

    Edit: Also for 7.8+ the umbracoUser2NodePermission-row can be changed to

    DELETE FROM umbracoUserGroup2NodePermission WHERE nodeId IN (SELECT id FROM umbracoNode WHERE (path LIKE '%-21%' AND id!=-21) OR (path LIKE '%-20%' AND id!=-20));
    

    // m

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    Jul 23, 2019 @ 23:01
    Alex Skrypnyk
    0

    Is this script working for the latest Umbraco version?

  • DT 4 posts 24 karma points
    Jul 30, 2019 @ 11:07
    DT
    0

    Can anyone help with a version to Umbraco 8?

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies