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?
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?
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?
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.
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 Enabled15 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.
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.
And I just confirmed the bug in Foundation 2020.07.1
this is strange behavior indeed
Episerver bug number: CMS-18509