cancel
Showing results for 
Search instead for 
Did you mean: 

How to delete content from contentstore that is not referenced in database???

nenad982
Champ on-the-rise
Champ on-the-rise
Hi all,

so I have a repository that contains binary files under alf_date/contentstore but I don't have that content in alf_content_url table in database. So it is obvious that somehow references to that content are removed from database but not from the file system (don't ask my how, I am new in this project and repository is obviously don't have valid state…). So because that content takes a lot of space on the dist, and I am not sure which binary file has reference in database and which not (there can be hundreds of thousands of documents are invalid), I have to delete that invalid content from file system.

So if I understand this deletion procedure correctly, when we delete something in application (Explorer or Share) it will go to Trashcan and it will stay there (is still under alf_data/contentstore). When this content is removed from Trashcan it will be marked in database as deleted and it will become orphan content, and by default it will stay in alf_data/contentstore at least 14 days, but after that it should be moved to alf_data/contentstore.deleted and we can remove it from file system at will. But this orphan content that I have problem with is from February 2013, and it still exists in contentstore?!

Does anybody has suggestion how I can achieve this? To delete all content from file system that is no longer referenced in database.

Thanks in advance…
1 REPLY 1

afaust
Legendary Innovator
Legendary Innovator
Hello,

the only sure way I can think of at this point is go for a SQL query to export the content URLs and whip up a script to remove these files.
Yes, the orphan handling should occur like you have stated. Your situation is indicative of a constellation where - for some reason - this did not work or was possibly circumvented by a poorly written addon (there are ways developers can write code that doesn't necessarily guarantee orphan detection / cleanup by Alfresco).

Regards
Axel