If you attach a file to a node and then create a new revision with the file removed, that file remains in the file system. This is expected behavior, as you would have the ability to revert to that previous revision and still require that file. However, if you delete that first revision (the only one to which that file is attached), the file remains in the file system.

As a test I also performed this same scenario with standard Drupal revisions (without Workbench Moderation), and it does remove the file when that initial revision is deleted.

Comments

Taxoman’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Priority: Normal » Major

Important that this cleanup happens, but equally important that the site admin have a custom setting to disable it on sites where the policy is to retain such files in the file system. Maybe with a new tab showing which files are currently "orphaned"?

dave reid’s picture

As far as I can tell, Workbench moderation doesn't handle anything with deletion of revisions - it's entirely Drupal core. The links generated to delete revisions from the Moderation tab point to node/[node:nid]/revisions/[node:vid]/delete which is a core path.

fasdalf@fasdalf.ru’s picture

This happens wothout workbench on my 7-10. Is this a core filefield bug?

stevector’s picture

Title: Workbench Moderation doesn't clean up files when revision is deleted » Behavior for files when revisions are deleted
Project: Workbench Moderation » Drupal core
Version: 7.x-1.x-dev » 7.x-dev
Component: Code » file system
Category: bug » support
Priority: Major » Normal

I'm not sure of the reasons for core's behavior. I'm changing this to a support request because the file module might be designed to work this way.

amateescu’s picture

Issue summary: View changes
Status: Active » Closed (duplicate)