문제

I was just wondering if anyone had any good, and most importantly - quick ways of deleting everything in their blocks / media libraries without having to go through every individual item, and moving it to Trash.

This is something I've been having to do before importing fresh data into my site, the only way I have found of doing it efficiently is to put everything into one folder with sub folders within it, this then allows me to delete the folder and all of its contents. But doesn't really help me with my current project where we already have a ton of assets that I don't really want to go through, moving etc..

I'm surprised there isn't a way to simply clear your library, or even select all and then move to trash?

Thanks, Giuseppe

도움이 되었습니까?

해결책

There is no easy way to do it from the GUI, as far as I know, but you do have the DeleteChildren method on IContentRepository. So creating a scheduled job or a plugin to do it for you should be pretty straightforward.

IContentRepository _contentRepository; // Get this from whereever
var blockRoot = new ContentReference(123); // Get this from whereever, i.e. a property on your startpage

_contentRepository.DeleteChildren(blockRoot, true, AccessLevel.NoAccess);

Also, if you do this on your media data, remember to run the "Remove abandoned BLOBs" scheduled job afterwards (unless it's autorunning on intervals) to clear up disk space.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top