4

Files that are "used in 0 places" (viewable at /admin/content/files) are not being deleted automatically by cron. They also show a status of permanent. How do I allow these files to be deleted by cron, or if not possible is there another way?

4

Prior to 8.4.x this was the default behaviour, but a number of issues with file reference counting meant it was possible for files to get deleted prematurely (and possibly also for stale files to linger, though that's not so important). In 8.4.x the default behaviour was changed: https://www.drupal.org/node/2891902.

For completion, to answer the question it's possible to change back to the old behaviour by setting make_unused_managed_files_temporary to true in file.settings. It's clearly not recommended (that's why core doesn't use it anymore) - see https://www.drupal.org/project/drupal/issues/2821423 to track progress on file reference tracking.

  • 2
    Well, it's not recommended, but it was always meant as a temporary stop-gap until the underlying problems are fixed. Not being able to delete files is of course a bug problem as well. Problem is, once that stop-gap was in, nobody cared about the underlying issues anymore and those issues haven't been updated since :) – Berdir Sep 18 '18 at 17:26
  • does that answer give a solution to the question ? i don't think so. How this behave with media module when a file media is added prior to insert it as a content entity reference? this new file has then 0 uses and it looks like it is not deleteable !! – Matoeil Jan 21 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.