[development] D6 Cleaning up on module uninstall
Jamie Holly
hovercrafter at earthlink.net
Wed Jan 26 22:11:00 UTC 2011
$result = db_query("SELECT nid FROM {node} where type='{whatever my
custom type is}'");
while ($row=db_fetch_object($result)){
node_delete($row->nid);
}
If your talking about images through imagefield, then that will delete
the files also.
One thing to note: Depending on how many nodes you have, this can choke.
It is generally best to do bulk deletes like this through the batch api
in batches of 50 or so.
Jamie Holly
http://www.intoxination.net
http://www.hollyit.net
On 1/26/2011 4:48 PM, jeff at ayendesigns.com wrote:
>
> I have my module -install- working fine...creating the needed
> vocabulary, cck content type with fields, adding the content type to
> the vocabulary. Now I'm working on the uninstall, and the seemingly
> infinite cleanup that's needed, not that anyone would ever want to
> remove my module, once installed!
>
>
> I believe I have the vocabulary and its data, and the cck content type
> and its data accounted for with:
>
>
> taxonomy_del_vocabulary($vid);
>
> drupal_load('module', 'content');
> content_notify('uninstall', 'my_module');
>
>
> and that brings me to nodes et al. There will be nodes (and node
> revisions) to be removed, and each node can have multiple field
> instances (cck image field). I don't seem to see a magic function
> that, given a node type, will remove all associated node data for that
> type. Also, I think I should remove the files that were uploaded as
> cck image content. Any tips on a good example of a complete "undo"? :)
>
> --
>
> Ayen Designs
> 388 Bullsboro Drive #105 · Newnan, Georgia 30263
> 404-271-9734
> Web:ayendesigns.com <http://ayendesigns.com>
> Blog: theAccidentalCoder.com <http://theaccidentalcoder.com>
> Drupal: j. ayen green <http://drupal.org/user/367108>
> IRQ: j_ayen_green
> IM (Yahoo) baalwww (MSN) baalwww at yahoo.com
> Skype: ayendesigns
>
> Ayen Designs is a tradename of the computer services division of
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20110126/38214dee/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ayenlogo
Type: image/jpeg
Size: 8316 bytes
Desc: not available
Url : http://lists.drupal.org/pipermail/development/attachments/20110126/38214dee/attachment.jpe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: acmelogo
Type: image/jpeg
Size: 1462 bytes
Desc: not available
Url : http://lists.drupal.org/pipermail/development/attachments/20110126/38214dee/attachment-0001.jpe
More information about the development
mailing list