The sql drop-scripts get sourced after all three of these.
Does anyone have a clear idea what optimally is supposed to happen when during this complex process?
There have been several threads about how nothing uninstalls correctly, but most of these were before these callbacks were added to the apm (I think). The most useful of these is this one but it deals with a package using the CR, which invokes issues different/beyond the simpler case of packages using just the acs object system. The only packages that use these callbacks at all are bug-tracker and simulation, and these are substantially more complex than the "simple" acs-object-based situation I'm starting with.
So here's what I'm doing: I filed a bug for Forums because as is, the package fails to uninstall due to referenial integrity violations in acs_objects. Jeff pointed out that package data needs to be deleted in the before_uninstantiate callback. So I tried this: in the before_uninstantiate callback, I delete from acs_objects all objects corresponding to forums_messages and forums_messages (since those are the only acs_objects that the Forums package directly creates).
I presumed that would work, but there are still referential integrity violations. Do the notifications-related need to be wiped here, too? It's hard to see why, as the acs_objects of "notification_type", "notification_interval", and "notification_delivery_method" have null context_ids. There is an acs_object with apm_package object_type that has the context_id of the package I'm uninstantiating, but if I add a call to delete this in my before_uninstantiate, I get different referential integrity violations involving site_nodes. Sheeit.
It seems that there should be some way to figure this out other than trial-and-error. I sketched out the calling chain invoked when you click on the "Delete Package" button on the /acs-admin/apm/package-delete page here. This shows (at admittedly a chunky granularity) what's going on, but it's not at all clear to me what needs to be accomplished during those callbacks.
Can someone who Gets This explain what best practices for these callbacks are so I can add 'em in to existing and future packages?