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.

Comments

danieldd’s picture

This 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

greg.harvey’s picture

Title: Does the normal method delete CCK content? » Module should use the core Batch API to avoid timing out

Altering the title slightly to what I think the issue is. Correct me if I'm wrong. Will try it out this afternoon.

gabor_h’s picture

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...

Please see this comment, if you would like to delete more than 1000 nodes at a time: http://drupal.org/node/466942#comment-2675220

kbahey’s picture

Category: support » feature

Changing this to a feature request.

Patches welcome.

gabor_h’s picture

Yes, 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.

dave reid’s picture

You're much better off using Views Bulk Operations instead. It uses batch API for deletion.

vacilando’s picture

I agree with Dave Reid that at the moment VBO is a much better solution. I am using it all the time.

ayesh’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev

I 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 :)

ayesh’s picture

Status: Active » Needs review
StatusFileSize
new3.78 KB

Please 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.

stefanhapper’s picture

Component: Documentation » Code

I have applied the patch provided in #9 and it works well!

deciphered’s picture

Status: Needs review » Needs work

Coding standards need work: http://drupal.org/coding-standards/

coderintherye’s picture

If someone wants to give this patch another try, and clean it up for coding standards, then I will commit it.

ayesh’s picture

Sorry 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.

coderintherye’s picture

Sure thing, take your time.

dafeder’s picture

Issue summary: View changes
Status: Needs work » Closed (duplicate)