How to make an image orphaned so that it gets removed?


(Anton) #1

Because message revisions are kept, and older removed messages are also kept, and even removed topics are still there in database, how do I make an image orphaned so it gets removed automatically by a sidekiq job?


(Jeff Atwood) #2

I believe this is already how it works, the files are already removed unless the file is referenced in the current post revision. @zogstrip can clarify.


(Régis Hanol) #3

All the details are available in this job

TL;DR: an image is orphaned if and only if it’s not referenced

  • in the latest version of a post
  • in a draft
  • in a queued post
  • in a logo site setting
  • in a custom emoji
  • in a theme
  • in a user avatar/background/card image
  • in a category logo/background image