Posted by zhgenti on November 7, 2011 at 5:34pm
4 followers
| Project: | File (Field) Paths |
| Version: | 7.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
Hi,
I've found out that file usage is increased incorrectly when saving new revision of the node. It happens because of call field_attach_update and passing node with revision flag equal to 1.
The fix is easy but i wasn't able to do it for the latest dev version, it seems not working, because of incorrect condition in the select query from the filefield_paths table.
When field settings are saved, only content type name is saved in the "type" column.
But when module tries to process it later it looks for key "$type::$bundle". Because of that files are not processed.
Please review the patch and consider updating module if the code is relevant.
Thanks,
Dmitry
| Attachment | Size |
|---|---|
| unnecessary-revision-for-fields-removed.patch | 682 bytes |
Comments
#1
Hi Dmitry,
Your patch looks good and I do remember confirming and fixing this issue in D6 so this fix (or similar) will be in the next Dev release.
Cheers,
Deciphered.
#2
Strike that last status, I wasn't able to reproduce this issue and therefore I don't want to commit anything unnecessarily.
Can you please provide more information (using the latest dev) on how to reproduce this issue? The patch you provided was clearly quite old as it was referring to $node, where the latest dev should have no reference to $node, only references to $entity.
Cheers,
Deciphered.
#3
Reproduce like this:
When content is saved, look in the database table file_usage and you should find that the file you uploaded has count = 2. This should really be 1. This makes files uploaded this way impossible to delete from within Drupal (e.g. IMCE) because even if you delete all revisions that uses the file, the count in file_usage will still be at least 1 and Drupal thinks that something is using the file.
I made a patch based on Dmitry's, but against the latest dev. This patch works for me.
(This is the first patch I posted to drupal.org, yay!)
#4
Issue confirmed, patch is (mostly) good and committed to 7.x-1.x.
Cheers,
Deciphered.
#5
Automatically closed -- issue fixed for 2 weeks with no activity.