Hi,
1) Does the node_delete() method automatically delete also all content of CCK fields in the given content type?
2) I have a content type with over 130k entries, on a production site, that I need to discard. There are many CCK fields in this content type that also must be deleted. I assume I will have to keep reloading the expiring page many times before all nodes in that content type are deleted. Is that the way to do it?
Thanks for working on this - this actually seems like something that should be a part of Drupal core one day. The logical thing for me to achieve the above would be going to /admin/content/types and deleting the content type - with all its node and CCK data. Or in /admin/content/node/overview, passing the work to cron in cases of mass deletions.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | batch_api_support_to_delete_all-437562-09.patch | 3.78 KB | ayesh |
Comments
Comment #1
danieldd commentedThis is now an old issue, but in case anyone is asking the same question I have successfully used this module (in normal mode) to delete 70,000 CCK nodes, each containing over 50 fields, plus related taxonomy terms, url aliases etc.
I found that the module deleted about 1000 nodes at a time before crashing. So effectively this meant going back and pressing the delete button many times. This was tedious but easier than doing this with views bulk operations, or deleting the content type and recreating each field, or trying to delete the records directly through the database.
Ideally this module would incorporate a batch delete function so it could cope better with very large numbers of nodes- which is where it is most useful/ essential.
I agree that this as a crucial module and should ultimately be in core. Thanks for maintaining it
Comment #2
greg.harveyAltering the title slightly to what I think the issue is. Correct me if I'm wrong. Will try it out this afternoon.
Comment #3
gabor_h commentedI found that the module deleted about 1000 nodes at a time before crashing. So effectively this meant going back and pressing the delete button many times. This was tedious...
Please see this comment, if you would like to delete more than 1000 nodes at a time: http://drupal.org/node/466942#comment-2675220
Comment #4
kbahey commentedChanging this to a feature request.
Patches welcome.
Comment #5
gabor_h commentedYes, Batch API could be a solution, as the title says.
However, I would like to mention that using Batch API and still calling the original node_delete() will result in a lot of watchdog and drupal_set_message calls, which you might want to avoid.
Comment #6
dave reidYou're much better off using Views Bulk Operations instead. It uses batch API for deletion.
Comment #7
vacilando commentedI agree with Dave Reid that at the moment VBO is a much better solution. I am using it all the time.
Comment #8
ayesh commentedI just needed to use this module hoping it will help me to delete all the contents in a node type (~7000 nodes) but this module didn't hand up. But it took a very long time so my guessing is that it will run as long as memory limit or max_execution_time hits.
I'm working on a batch api project so I managed to use batch API so I could use batch api for this.
I will post a patch with modifications soon.
(Drupal 7).
Please let me know if you guys are need to go with VBO. I'll happily stop it :)
Comment #9
ayesh commentedPlease review the patch.
I have added a new option "Batch API" to methods, and in the submit function, if the batch_api option is selected, it will run a batch_set() to perform the action on chosen nodes.
It can count processed rows and dsm() after finishing.
Comment #10
stefanhapper commentedI have applied the patch provided in #9 and it works well!
Comment #11
deciphered commentedCoding standards need work: http://drupal.org/coding-standards/
Comment #12
coderintherye commentedIf someone wants to give this patch another try, and clean it up for coding standards, then I will commit it.
Comment #13
ayesh commentedSorry for taking much time for a clean up. To be honest, I'm not an expert in code standards subject so please be bear with me in this. I will post a new patch soon with clean ups I can find.
Thanks.
Comment #14
coderintherye commentedSure thing, take your time.
Comment #15
dafederDuplicate of #2116349: Implement Batch API