Hi

When deleting a node, all revisions should be deletet. But there is a problem with the file_usage of older versions!

Steps to reproduce:

  1. Fresh drupal installed (7.30)
  2. Diff installed (7.x-3.2)
  3. make a content type with a image field; enabled revisions for this content type
  4. create a node with an image
  5. edit the node (change the image)
  6. file_usage shows now 2 rows with the same node id, because of the revision. Thats all correct at the moment.
  7. delete the node
  8. file_usage shows one row!! Only the actual file entry was deleted
  9. i can't delete the file now (with imce or something), because drupal says me the file is still in use, but it isn't!

Comments

alan d.’s picture

Are you sure that the Diff module actually causes this? It doesn't actually interact with the revision system at all like this (but I could be wrong).

Cogax’s picture

It has to! I tried it out without any module(diff):

  1. Fresh drupal installed (7.30)
  2. make a content type with a image field
  3. create a node with an image
  4. file_usage shows 1 row (correct)
  5. edit the node (change the image)
  6. file_usage shows 1 row (correct, only the new image because no revisions are saved!)
  7. delete the node
  8. file_usage is clear now

If a node is deleted there should be a query wich checks the file_usage for the column type=node and id=node_id_to_delete and should delete all records. Or i'am wrong?

alan d.’s picture

Revisions are part of core, not the Diff module. In the above, there are 4 core combos to test.

Same steps, without Diff.
Same steps, with Diff.

Both should be exactly the same

Same steps, without Diff; but with Create new revision checked during save. Delete one revision.
Same steps, with Diff; but with Create new revision checked during save. Delete one revision.

Both should be exactly the same; if not, then Diff is to blame

If the same, enable all file and permission related modules 1 by 1, repeating the test till you find the combo that fails.

Cogax’s picture

Status: Active » Closed (works as designed)

I was thinking revisions are supported from the diff module and not from core! Sorry for that!! Its definitely not a diff bug. I searched again and ended up here: https://www.drupal.org/node/1239558 So i think for the moment its the best solution to implement hook_node_delete as describe in #10 for drupal 7.x.
Thanks for your help!

alan d.’s picture