Posted by fago on
- Comments, terms, and vocabularies invoke
hook_entity_delete()after the entity has been already deleted.
- Nodes, users, and files invoke the hook first, which is inconsistent.
hook_entity_delete()is invoked after deletion, as this is consistent with load/insert/update hooks.
- Comments need to be deleted before node deletion. See .
hook_entity_presave()), so that modules can act before entity deletion.
- Add the predelete hook to comments, terms, and vocabularies.
- For users, files, and nodes:
- Rename the delete hooks and all their implementations to be predelete hooks
- Invoke the delete hook separately after entity deletion.
(This ensures the existing code execution order is not changed, as that could have unexpected side effects.)
- Add test coverage to ensure the proper hook ordering for entity hooks. (Replace the
Patch in #37 includes all of the above changes.
- Consider converting deletion hooks to work on multiple entities at once, similar to
hook_entity_load(). This would increase performance for mass-deletions.
- Fix the hook ordering for
- The following hooks are added:
- All core implementations of the following hooks are changed:
- hook_node_delete() to hook_node_predelete()
- hook_user_delete() to hook_user_predelete()
- hook_file_delete() to hook_file_predelete()
PASSED: [[SimpleTest]]: [MySQL] 34,207 pass(es).
[ View ]
PASSED: [[SimpleTest]]: [MySQL] 34,215 pass(es).
[ View ]