XF 2.2 How to correctly delete old attachments

karnaf

Member
To save some space I am looking for ways to:
1. Delete attachments with 0 views within last year
2. Delete attachments not assigned to anything (uploaded and not posted to a post or PM)
3. If above not possible then delete attachments older than 2 years.

I could delete the records in the DB but the point of this would be to delete the files too.
What would you say is the correct method for this?

Thanks
 

karnaf

Member
Its tens of thousands of files, maybe even more. So its not possible to use the UI.
Also it doesnt offer any kind of filtration to achieve any of my goals.
 

karnaf

Member
We dont use it. And migrating to S3 would not really solve my problem. It would be more expensive and still no real way to delete what I want since it requires data from the DB about views and linked content.

I could write a bash script to delete files older than 2 years but: It could delete old popular files. And not sure how to update the DB to flush the missing files. But that's plan B.
 
Top