Permanent Deleting of files still doesn't work for me (make_unused_managed_files_temporary = true)

Drupal Answers Asked by Maxo on February 17, 2021

make_unused_managed_files_temporary didn’t work for me.

I am using Drupal backend for the REST API frontend application.

Thats how the File input looks (because I am not sure if that setting is for that File elements, but guess so).

How file field looks

I read some informations about permanent files deleting, because I would like to delete files permanent from the file system and also database.

I was set the make_unused_managed_files_temporary to true and debuging, this is really true in the code.

I also found the configuration in Backend / File system – Delete temporary files after (6 hours), so this is on.

I am checking also the database file_managed before and after (and after 6 hours) file deletion for the flags like status that indicates isTemporary() method. But after uploading file, saving… then editing, and removing file, the file is still in the database as a status 1.

I am also checking DB table file_usage where there is still the item with count=1 too, that should be not true (because of deletion).

And files maybe should move to /tmp folder, but that doesnt.
I am working on Drupal 8.5.6 and 8.7.2 on production, but the behaviour is the same.
I am doing something wrong? Is there some cron to be configured? Or another futher settings?

Edit 1: I think it is not a Media, but simply file widget – /core/module/file

Edit 2: The main problem is that, when I delete file, it stay in the database as a permanent flag (status=1), and also it has a count of usage 1 (file_usage=1). When I manually update database to set status=0 and count=0, the cron works OK. Why the file usage and count stay on?

Add your own answers!

Related Questions

“&” displaying as “&”

1  Asked on February 28, 2021 by mohk


Confirmation pop up on login submit

1  Asked on February 22, 2021 by vipin-p


Override a node page of specific content with views page

1  Asked on February 21, 2021 by hkguile


Hide Alt and Title for image field

2  Asked on February 20, 2021 by moto


How do I update from 9.0.10 to 9.1.0?

1  Asked on February 19, 2021 by user101999


Adding fields to content type edit form (not to the node itself)

1  Asked on February 18, 2021 by chris-riddell


Uploaded images in theme settings is going to be lost

3  Asked on February 13, 2021 by saidbakr


How to delete a large amount of nodes effeciently during cron?

1  Asked on February 12, 2021 by athakhan


Composer updates .htaccess file when updating

3  Asked on February 11, 2021 by albertski


How to print the Views title in page.tpl.php?

3  Asked on February 10, 2021 by szymon-panecki


May I use Bootstrap-CDN on Subtheme for production site?

1  Asked on February 7, 2021 by leelandra


Alter Webform email body

1  Asked on February 6, 2021 by lus


Ask a Question

Get help from others!

© 2023 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP