Copied to clipboard

Flag this post as spam?

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

  • Jason Espin 368 posts 1335 karma points
    Jul 17, 2015 @ 10:31
    Jason Espin

    Delete / empty recycle bin event in Umbraco

    Hi all,

    For some time there has been a really annoying 'feature' of Umbraco where if you delete an item in the media section of Umbraco and then clear it from the recycle bin, the image is cleared from Umbraco but is still left in a media folder on the server.

    Does anyone know what event I can hook into to delete these leftover folders on the server? Ideally I would like to hook into the 'Empty recycle bin' event so that the items are deleted from the server like they should have been all along.

    Any help / pointers would be greatly appreciated.

  • AmandaEly 123 posts 379 karma points
    Dec 10, 2015 @ 09:35

    Can't help you but I can confirm that this also happens in the media recycle bin. I deleted 33k media nodes using the media service and they are still there in the recycle bin. mediaservice.EmptyRecyclebin() crashes with This SqlTransaction has completed; it is no longer usable.

    I got the same crash working from the Umbraco Office media dashboard.

    Classic Umbraco. It's a known bug. Using 7.2.8

  • AmandaEly 123 posts 379 karma points
    Dec 10, 2015 @ 10:32

    This method worked for me:

    private static void CheckGalleryFiles(ApplicationContext context) { var mediaService = context.Services.MediaService; var recycled = mediaService.GetMediaInRecycleBin(); foreach (var re in recycled) { Console.WriteLine("Deleting {0}", re.Name); mediaService.Delete(re); } }

    The console writeline is there as it takes a long time and you'll go mad waiting otherwise. The Umbraco back office now shows an empty recycle bin

Please Sign in or register to post replies

Write your reply to: