Imagefield images deleted along with nodes
mrfelton - February 14, 2009 - 10:35
| Project: | Revision Deletion |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | won't fix |
Jump to:
Description
I ran this on my site and I lost a whole load of images that had been attached to nodes with the imagefield module. The images were still attached to the latest revision of the nodes and so they should not have been deleted. Marking as critical as this could do real damage. Luckily I did it on a copy of my site!

#1
What happens if you *manually* delete a revision that has an imagefield? Does the image still get deleted or not?
The reason I ask is that the revision deletion code is very simple, and the problem may actually be arising somewhere else (e.g. in core, or in imagefield.module).
The relevant code is:
<?php$node = node_load($data->nid, $data->vid);
db_query("DELETE FROM {node_revisions} WHERE nid = %d AND vid = %d", $data->nid, $data->vid);
node_invoke_nodeapi($node, 'delete revision');
?>
And the code used by core in http://api.drupal.org/api/function/node_revision_delete_confirm_submit to do the business is identical.
#2
No further update, so can't be too critical.
#3
No further update.