Index: openacs-4/packages/acs-tcl/tcl/site-node-apm-integration-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/site-node-apm-integration-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-tcl/tcl/site-node-apm-integration-procs.tcl 11 Jul 2002 04:30:28 -0000 1.2 +++ openacs-4/packages/acs-tcl/tcl/site-node-apm-integration-procs.tcl 14 Aug 2002 19:05:08 -0000 1.3 @@ -20,20 +20,45 @@ } { create site node, instantiate package, mount package at new site node } { - set node_id [site_node::new -name $name -parent_id $parent_id] + db_transaction { + set node_id [site_node::new -name $name -parent_id $parent_id] - set package_id [apm_package_create_instance $instance_name $context_id $package_key] + set package_id [apm_package_create_instance $instance_name $context_id $package_key] - site_node::mount -node_id $node_id -object_id $package_id + site_node::mount -node_id $node_id -object_id $package_id - site_node::update_cache -node_id $node_id + site_node::update_cache -node_id $node_id + + # call post instantiation proc for the package + apm_package_call_post_instantiation_proc $package_id $package_key + } - # call post instantiation proc for the package - apm_package_call_post_instantiation_proc $package_id $package_key - return $package_id } + ad_proc -public delete_site_nodes_and_package { + {-package_id:required} + } { + First deletes ALL the site nodes this instance is mapped to, then deletes the instance. + + } { + db_transaction { + # should here be a pre-destruction proc like the post instantiation proc? + foreach site_node_info_list [site_node::get_all_from_object_id -object_id $package_id] { + + ns_log notice "aks1: $site_node_info_list" + + array set site_node $site_node_info_list + + site_node::unmount -node_id $site_node(node_id) + site_node::delete -node_id $site_node(node_id) + site_node::update_cache -node_id $site_node(node_id) + } + + apm_package_delete_instance $package_id + } + } + ad_proc -public get_child_package_id { {-package_id ""} {-package_key:required} Index: openacs-4/packages/acs-tcl/tcl/site-nodes-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/site-nodes-procs.tcl,v diff -u -r1.13 -r1.14 --- openacs-4/packages/acs-tcl/tcl/site-nodes-procs.tcl 13 Jul 2002 00:50:56 -0000 1.13 +++ openacs-4/packages/acs-tcl/tcl/site-nodes-procs.tcl 14 Aug 2002 19:05:08 -0000 1.14 @@ -195,10 +195,26 @@ {-object_id:required} } { return the site node associated with the given object_id + + WARNING: Returns only the first site node associated with this object. } { return [get -url [lindex [get_url_from_object_id -object_id $object_id] 0]] } + ad_proc -public get_all_from_object_id { + {-object_id:required} + } { + return a list of site nodes associated with the given object_id + } { + set node_id_list [list] + + foreach url [get_url_from_object_id -object_id $object_id] { + lappend node_id_list [get -url $url] + } + + return $node_id_list + } + ad_proc -public get_url { {-node_id:required} } {