Forum OpenACS Development: Re: WARNING: site_node::get_children returns incorrect result set
Yes, I'm deleting subsites. However, it's not limited to that scope. You can feed it any site node and it will clean up beneath that point.
I don't have (unrealistic) high hopes that removing nodes already populated with user data will be a snap. Not from what I've seen so far of packages cleaning up without RI violations.
If you disregard the complexities of cleaning up data and assume the package writer has done it right, the code to delete a subsite is fairly simple and straightforward.
I placed a file in the openacs storage area for you at http://openacs.org/storage/download/site-tree-delete.tcl?version_id=120452.
You'll see some hacks in there. There's a particularly ugly one that compensates for a kernel bug. Yes, I posted a patch, but it's no less ugly.