Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295245

Deleting an entity with revisions and file/image field does not release file usage of non-default revisions, causing files to linger

$
0
0

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:

  1. create an article node with an image A uploaded to its image field
  2. verify that the uploaded file A has its status column in the file_managed table set to 1,
    and it has 1 usage in the file_usage table
  3. edit the node, check the "Create new revision" checkbox, remove the original image A and upload a new image B, save
  4. verify that the uploaded file B has its status column in the file_managed table set to 1,
    and it has 1 usage in the file_usage table. Verify that the rows for file A are unchanged in both tables.
  5. delete the article
  6. verify that the uploaded file B has its status column in the file_managed table set to 0, and it has no row anymore in the file_usage table
    • Expected result: file A has its status column in the file_managed table set to 0, and it has no row anymore in the file_usage table
    • Actual result: file A has its status column in the file_managed table still set to 1, and it still has n1 usage in the file_usage table
  7. run cron 6 hours later (this is the default value of the temporary_maximum_age setting in system.file)
  8. 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)
  9. 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


Viewing all articles
Browse latest Browse all 295245

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>