Index: openacs-4/packages/acs-tcl/tcl/apm-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/apm-procs.tcl,v diff -u -N -r1.16 -r1.16.2.1 --- openacs-4/packages/acs-tcl/tcl/apm-procs.tcl 28 Nov 2001 21:32:52 -0000 1.16 +++ openacs-4/packages/acs-tcl/tcl/apm-procs.tcl 10 Apr 2002 02:26:20 -0000 1.16.2.1 @@ -844,7 +844,7 @@ } -ad_proc -public apm_package_instance_new { +ad_proc -public apm_package_create_instance { { -package_id 0 } @@ -870,7 +870,20 @@ }] apm_parameter_sync $package_key $package_id + + return $package_id +} + +ad_proc -public apm_package_call_post_instantiation_proc { + package_id + package_key +} { + + Call the package-specific post instantiation proc, if any + +} { + # Check for a post-instantiation TCL procedure set procedure_name [apm_post_instantiation_tcl_proc_from_key $package_key] if { ![empty_string_p $procedure_name] } { @@ -881,10 +894,29 @@ } } - return $package_id } +ad_proc -public apm_package_instance_new { + { + -package_id 0 + } + instance_name context_id package_key +} { + Creates a new instance of a package and call the post instantiation proc, if any. + + DRB: I split out the subpieces into two procs because the subsite post instantiation proc + needs to be able to find the package's node in the site node map, which results in a + cart-before-the-horse scenario. The code can't update the site node map until after the + package is created yet the original code called the post instantiation proc before the + site node code could update the table. + +} { + set package_id [apm_package_create_instance -package_id $package_id $instance_name $context_id $package_key] + apm_package_call_post_instantiation_proc $package_id $package_key +} + + ad_proc apm_parameter_sync {package_key package_id} { Syncs the parameters in the database with the memory cache. This must be called