revision_deletion_delete_rev has wrong order of execution.
db_query("DELETE FROM {node_revisions} WHERE nid = %d AND vid = %d", $data->nid, $data->vid);
$node = node_load($data->nid, $data->vid);
node_invoke_nodeapi($node, 'delete revision');
should be
$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');
since node_load will return false in case the entry from the node_revisions table is deleted before node_load is called.
Comments
Comment #1
bwynants commentedPatch attached
Comment #2
bwynants commentedhow to clear dangling table entries ?
Comment #3
Gman commentedGreat post. Let me review this issue and the follow up attachment to remove dangling entries. I will use the install_hook to execute the above code during an update.php cycle.
Comment #4
bwynants commentedyeah, problem is that it's impossible to know ALL tables that have dandling entries and after executing you should also clear the cache tables.
Comment #5
Gman commentedSorry for the long delay. I have finally updated this in the Drupal 5 and 4.7 branches.
Comment #6
(not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #7
bwynants commentedsame issue in 6.0 verions
Comment #8
Gman commentedCommitted. THank you.