SaaS CMS has officially launched! Learn more now.

Scheduled task Automatic Emptying of Trash leaves media items



When I run the Automatic Emptying of Trash all blocks and pages are removed correctly but media files like images, pdf, docx etc still stays and won't get removed from the bin?
If I remove the one by one they are removed.

Why is this?



Edited, Feb 08, 2021 14:59

Hi Kristoffer,

I looked into the code for job (EPiServer.Util.EmptyWastebasketJob) and found that it it only checking for if content is inherited from IContent, it is marked as IsDeleted = true, Saved Date is not greater than DateTime.Now.AddDays(-30.0) (Checking if it was moved to trash older than 30 days).

And then call for 

this._contentRepository.Delete(virtualWastebasket.ContentLink, true, AccessLevel.NoAccess);

Here, the forceDelete param passed as true. So, if you are not getting any error logged, then can you verify if those are removed older that the 30 dayes from the job ran?

Feb 09, 2021 16:31

Hi Praful,

I guess then the media files shoud be removed? Could it be that IsDeleted is not set for media files?
I ran the job but found no errors in the log.

UPDATE: I just checked this on another site and that works just fine, media are removed from the recycle bin when running the task? What could be special with the site where it wont work?


Edited, Feb 12, 2021 16:03

The only thing I can think of, the media links are not removed when we move that to bin and the media which have link somewhere (on page or block) might not getting deleted. Which is what the property IsDeleted might not setting to checked when we move media to bin (by clicking on Move anyway). And this could be a bug in the system. We should raise a ticket to Episerver support.

Feb 13, 2021 1:21


I just got access to the db and this is how the content looks in the tblContent:

    pkID    fkContentTypeID    fkParentID    ArchiveContentGUID    CreatorName    ContentGUID    VisibleInMenu    Deleted    ChildOrderRule    PeerOrder    ContentAssetsID    ContentOwnerID    DeletedBy    DeletedDate    fkMasterLanguageBranchID    ContentPath    ContentType    IsLeafNode
   55846    36    2    NULL        779982FB-BEC1-4804-BDB5-725EE360D1F9    1    1    3    100    NULL    NULL    MyUserId    2020-02-20 09:33:28.180    15    .1.2.    2    1

A funny thing is that fkMasterLanguageId is 15 and this is how 15 looks in the database

    pkID    LanguageID    Name    SortIndex    SystemIconPath    URLSegment    ACL    Enabled
15    15                         NULL    150        NULL    NULL    0

Should there be an "empty language" in the database?

I have tried to change 15 to 8, Swedish, but it still remains in that recycle bin. I cannot se anything that should keep this content from being deleted.

I will send this to Episerver.


Edited, Feb 17, 2021 8:14
Praful Jangid - Feb 17, 2021 8:27
Let's see what Epi can help with. I am agreed to log a bug to support.
Tomas Hensrud Gulla - Feb 17, 2021 8:55
Media files are by default not localizable, so the empty language no 15 makes sense.


So I finally found out what caused the problem. I wrote my own job and debugged it and found out that the Saved date in the tblContentLanguage was modified. And it is actually the Episerver scheduled task Clear Thumbnail Properties, that does it. I looked at the modified Saved date and looked for a scheduled task that run approxiamtly that time and found the Clear Thumbnail Properties. For some reason it updates the Saved date for all our media in the Waste basket and therefore the waste basket stays the same. 

Really strange but I'm glad I found it.

I will file a bug on this one.



Mar 01, 2021 18:15
Tomas Hensrud Gulla - Mar 01, 2021 19:57
Nice find! If possible, please post the bug number, when accepted by Episerver.
Praful Jangid - Mar 02, 2021 6:15
Good job Kris...glad you found the cause...

And I just confirmed the bug in Foundation 2020.07.1

Mar 01, 2021 21:09

this is strange behavior indeed

Mar 01, 2021 21:11

Episerver bug number: CMS-18509

Mar 02, 2021 8:55
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.