While working on #8: Let users cancel their accounts, I discovered that we have node_mass_update() for updating many nodes in a batch, but no node_mass_delete()
for deleting many nodes in a batch.
Aside from the fact that an administrator can delete many nodes using the node mass-operations on admin/content/node, the new account cancellation methods also allow administrators to delete all contents of a user. When an administrator is forced to delete a long-time user with all of his contents, then this could easily result in thousands of nodes having to be deleted.
We have two options to solve this issue:
- Introduce a node_mass_delete() function, using almost the same pattern as node_mass_update() - most probably leading to almost identical/duplicated code.
- Make node_mass_update() more flexible, f.e. passing
array('nid' => NULL)
can only mean that nodes shall be deleted.
Comment | File | Size | Author |
---|---|---|---|
#3 | node-355905-3.patch | 14.45 KB | bradfordcp |
Comments
Comment #1
swentel CreditAttribution: swentel commentedI somehow see a third option: rename node_mass_update and _node_mass_update_helper to a more general name, because with few small code changes it should be possible to either create, update or delete a node with only one function. Saves kittens imo :)
Comment #2
Jody LynnBatch delete would also be useful to this issue: #362795: Delete Entire Book
Comment #3
bradfordcp CreditAttribution: bradfordcp commentedThis is a first attempt at creating a new mass_operation function for nodes. To summarize the patch:
node_mass_operation($nodes, $op, $updates = array()
This provided the flexibility needed to allow mass delete operationsComment #4
bradfordcp CreditAttribution: bradfordcp commentedFor some reason the status did not change...
Comment #6
Jody Lynnnode_delete_multiple has landed: #457080: Add node_delete_multiple()
Comment #7
sun#705306: user_cancel_delete method calls into a "standard" user_delete_multiple API
Comment #8
sunComment #9
catchPatch here #89181: Use queue API for node and comment, user, node multiple deletes.