Needs work
Project:
Workbench Moderation
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
12 Apr 2012 at 11:26 UTC
Updated:
21 Sep 2016 at 19:52 UTC
Jump to comment: Most recent
Comments
Comment #1
Wolfgang Reszel commentedI've some more informations. When saving a revision the count field in the file_usage table is increased by 2 but when deleting it's decreased by 1.
Comment #2
agentrickardMoving to the proper queue.
Comment #3
sachandi am facing same problem , it does not allow me to delete files that are no more used ( revisions using these files are deleted) . If anyone found resolution /workaround on this please share.
Comment #4
jwilson3I wonder how this could be even an issue for the workbench_moderation module, as it only piggybacks on the existing
node/%node/revisions/%/deletemenu item and the accompanyingnode_revision_delete_confirm_submit()function both provided by the core node module.Can someone confirm that this issue *only* happens when workbench_moderation is enabled, and that with Workbench_Moderation disabled, Drupal core does properly cascade file deletions when you delete a revision?
Comment #5
agentrickardComment #6
Wolfgang Reszel commentedIf I remember right I found out that Workbench Moderation is causing this issue by deactivating it. Then deleting nodes worked as expected. Well, it's long ago, so I can remember wrong. The project doesn't depend on Workbench Moderation anymore.
Comment #7
hypertext200I can confirm that, I used file module to attach nodes in to the Article content type and those files never deleted whenever revisions are deleted.
Comment #8
overtune commentedThe problem doesn't only occur when deleteing revisions.
If you do like this:
1. Create a new node and add a file.
2. Create new draft and delete the file, then publish this draft.
3. Delete the node.
Now the file is still on the server, and in the database.
Comment #9
hass commentedThis means we also need an upgrade hook to run with this bugfix and delete stale files without references. I hope this is possible.
Comment #10
jwilson3I'm confused by comment #7, @heshan.lk. It sounds like you're confirming that this is in fact a Drupal core issue (with just files module and revisions enabled). No? If so, then the next step is to open a core issue, and mark this as postponed again.
Comment #11
hass commentedMay be a core bug, too. See #1239558: Deleting an entity with revisions and file/image field does not release file usage of non-default revisions, causing files to linger
Comment #12
phillamb168 commentedAs an FYI, there appears to be a fix for this in the 3.x branch which can also be applied to 1.x. Briefly, while there is indeed a problem in core for file management with revisions (which can be fixed by the following patch: https://www.drupal.org/files/node_system-delete_node_revision_hook-12395...), there is also an issue with how Workbench Moderation deals with field_attach_update() and file_field_update(). More information is available in the linked issue.