Problem/Motivation
When deleting large datasets the delete multiple API does not invoke all dependent hook_[node|comment|user]_delete.
e.g. deleting a node does not invoke hook_comment_delete()
Proposed resolution
Use the queue API to delete large datasets so we can invoke all hooks.
Remaining tasks
This issue is looking for further direction. Some of the questions/issues are:
- Does this issue cause problems/confusion for users that are expecting all records to be deleted?
- Should the user be aware that the operation is happening via queues/cron?
- If the deletes are happening through the UI, the batch API could process everything. Could the UI create a queue and parse to the batch API to process so you don't have to wait for cron to complete?
User interface changes
When deleting large datasets, you are advised that only a subset of the objects have been deleted and the remaining will been queued to be deleted on cron. A link is shown to run the cron manually if user has permission to "administer site configuration"
API changes
[node|comment|user]_delete_multiple no longer will always delete all items instantly, instead it deletes the the first 20 (or the defined queue threshold number) with the remaining items deleted on cron through a queue.
If the number of items being deleted is less than the queue threshold number, then the current behavior of the system will remain unchanged.
Original report by fajerstarter
Deleting a node that has comments deletes its comments. The problem is that this doesn't initiate hook_comment($op='delete'). Modules using hook_comment need this. This might be the case for Drupal-cvs as well though this hasn't yet been tested.