What would be the correct way to remove all images from all PM topics with no activity for e.g. 1+ years. I’d like to do so as a means to reduce storage occupied by uploads.
By making so in a “correct way” I mean in such a way that the images will be then automatically removed / cleaned up as not used ones (orphan ones).
I would write a plugin with a background job that runs daily and replace all images with some text (eg “
[image removed after 1 year]”) in the
raw version of posts in PM older than 365 days. Discourse will do the rest.
Should be achievable by a sql query? I could run it manually once a year What field should I update to trigger re-cooking a message in which the “raw” content gets changed
I think your solution might involve this: Replace a string in all posts