Problem/Motivation
Images/files uploaded to a file/image fields on entities with multiple revisions are never deleted, even when the entity is deleted. Because the file usage counts for the revisions is never released.
Steps to reproduce:
- create an
article
node with an image A uploaded to itsimage
field - verify that the uploaded file A has its
status
column in thefile_managed
table set to1
,
and it has 1 usage in thefile_usage
table - edit the node, check the "Create new revision" checkbox, remove the original image A and upload a new image B, save
- verify that the uploaded file B has its
status
column in thefile_managed
table set to1
,
and it has 1 usage in thefile_usage
table. Verify that the rows for file A are unchanged in both tables. - delete the article
- verify that the uploaded file B has its
status
column in thefile_managed
table set to0
, and it has no row anymore in thefile_usage
table - Expected result: file A has its
status
column in thefile_managed
table set to0
, and it has no row anymore in thefile_usage
table - Actual result: file A has its
status
column in thefile_managed
table still set to1
, and it still has n1 usage in thefile_usage
table
- Expected result: file A has its
- run cron 6 hours later (this is the default value of the
temporary_maximum_age
setting insystem.file
) - verify that uploaded file B is now removed (because usage = 0)
- expected result: the uploaded file A is still present (because usage > 0)
- actual result: the uploaded file A is absent (because usage = 0)
Proposed resolution
TBD, see #126 for an summary of comments #1–#125.
Remaining tasks
TBD
User interface changes
None.
API changes
TBD
Data model changes
TBD