instance-delete.tcl
Delete a package instance. If the package is mounted it will be unmounted before deletion and an attempt will be made to delete the node.
- Location:
- /packages/acs-subsite/www/admin/site-map/instance-delete.tcl
- Author:
- Bryan Quinn <bquinn@arsdigita.com>
- Created:
- Mon Oct 23 14:58:57 2000
- CVS ID:
$Id: instance-delete.tcl,v 1.12.2.4 2019/12/17 13:07:46 antoniop Exp $
Related Files
[ hide source ] | [ make this the default ]
File Contents
ad_page_contract { Delete a package instance. If the package is mounted it will be unmounted before deletion and an attempt will be made to delete the node. @author Bryan Quinn (bquinn@arsdigita.com) @creation-date Mon Oct 23 14:58:57 2000 @cvs-id $Id: instance-delete.tcl,v 1.12.2.4 2019/12/17 13:07:46 antoniop Exp $ } { package_id:naturalnum } db_transaction { # DRB: There used to be a "catch" around the "set" but I removed it because # 1. blank is returned if no node_id exists for the object # 2. the following "if" would throw an error if the "catch" caught anything ... set node_id [site_node::get_node_id_from_object_id -object_id $package_id] # DRB: This is a small trick. If you mount subsite "foo", visit its sitemap page # and delete it, you got an error when the code attempted to return. So this code # will go to the deleted node's parent page which should either be the site map page # you were at when you clicked "delete" or its parent (the case mentioned above). set parent [site_node::closest_ancestor_package \ -node_id $node_id \ -package_key acs-subsite \ -element url] # node_id was null so we're not deleting a mounted subsite instance if {$parent eq "" } { set parent [ad_conn subsite_url] } if { $node_id ne "" } { # # The package is mounted, unmount it and delete it together # with the site node. # site_node::unmount -node_id $node_id # # Since we do not want to delete the potentially shared # service packages, delete just the service nodes but not the # packages behind it. # site_node::delete_service_nodes -node_id $node_id # # Finally, delete the site-nodes and the packages under it. # site_node::delete -node_id $node_id \ -delete_subnodes -delete_package } else { # Delete the package apm_package_instance_delete $package_id } } on_error { if {[db_0or1row instance_delete_doubleclick_ck { select 1 from apm_packages where package_id = :package_id }]} { ad_return_error "Error Deleting Instance" "The following error was returned: <blockquote><pre>[ns_quotehtml $errmsg]</pre></blockquote>" } } ad_returnredirect ${parent}admin/site-map ad_script_abort # Local variables: # mode: tcl # tcl-indent-level: 4 # indent-tabs-mode: nil # End: