Hi there,

In Sector Drupal 8+ our expectation is that media assets - files, images, local videos - are deleted from the filesystem after the parent media entity is deleted.
One reason why we use media is to allow editorial teams to be able to take control of their files in the public file system. Outdated files or files wrongly uploaded need to be deleted form the file system in a safe and secure manner.

There seems to be no consensus around this in the community at this stage.
Discussion is - https://www.drupal.org/project/drupal/issues/3027324#comment-13027856

Not deleting unused files automatically was introduced in 8.4 following https://www.drupal.org/node/2891902. The main reasons were several critical bugs with the "file usage" tracking: files wrongly set to have >0 uses are deleted even though they are in use. Most issues are around translation, or where files are uploaded to a site without a parent media entity.

In Sector out of the box, we upload all files using media.
Requested change: opt-in to file deletion by changing `make_unused_managed_files_temporary` in the Sector `file.settings` yml config to `TRUE`."
Delete all temporary files on the next cron run when they are older than one hour.

Add to documentation to ensure sitebuilders are aware of this. For Sector sites that use translation we recommend to follow the related issues and opt-out if required or extent the time a file can remain in the temporary directory.

Ta,

Heike

CommentFileSizeAuthor
#3 auto-delete-files_3150710_3.patch633 bytesDanielVeza
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

HeikeT created an issue. See original summary.

HeikeT’s picture

Issue summary: View changes
DanielVeza’s picture

Added the make_unused_managed_files_temporary and file.settings settings.

DanielVeza’s picture

Status: Active » Needs review

  • DanielVeza committed 66441db on 5.0.x
    Issue #3150710 by DanielVeza, HeikeT: Delete media assets from the...
DanielVeza’s picture

Status: Needs review » Fixed

Committed, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.