backdrop / backdrop-issues

Issue tracker for Backdrop core.
144 stars 40 forks source link

[D8] Allow BACKDROP_MAXIMUM_TEMP_FILE_AGE to be overridden/disabled #6389

Open klonos opened 8 months ago

klonos commented 8 months ago

The garbage collection grace period is currently hard-coded to 6hrs (21600 seconds) in the BACKDROP_MAXIMUM_TEMP_FILE_AGE constant in core/modules/system/system.module. We should allow this to be configured, at least via settings.php but ideally via the UI as well.

In D8+, this is controlled by a "Delete temporary files after" setting under admin/config/media/file-system:

image

The help text for this setting reads:

Temporary files are not referenced, but are in the file system and therefore may show up in administrative lists. Warning: If enabled, temporary files will be permanently deleted and may not be recoverable.

Because of a known, critical data loss issue (https://www.drupal.org/project/drupal/issues/2821423 - issue open since 2016 😬 ), the option to disable deletion of temporary files was introduced in D8.4 (see https://www.drupal.org/project/drupal/issues/2801777 - and respective change record):

After this change

A new make_unused_managed_files_temporary setting exists in file.settings which is set to false by default, for both existing and new sites.

Any file that is "permanent" is no longer downgraded to "temporary" automatically. Therefore it is also never deleted. This change in default behavior is necessary to prevent data loss due to the other bugs ...

klonos commented 8 months ago

For historic purposes, and to provide a valid use case: in the GovCMS distro/hosting the deletion of temp files was permanently disabled and "locked" (via settings.php) after many Aussie gov sites agencies started reporting "random" disappearances of files from their sites.