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.114.2.17 -r1.114.2.18 --- openacs-4/packages/acs-tcl/tcl/apm-procs.tcl 19 Oct 2020 15:19:13 -0000 1.114.2.17 +++ openacs-4/packages/acs-tcl/tcl/apm-procs.tcl 20 Oct 2020 12:21:48 -0000 1.114.2.18 @@ -1834,16 +1834,30 @@ set instance_name "$p_name" } } + # + # Do not do anything for already instantiated singleton packages + # + if {![db_0or1row instantiated_singleton_p { + select package_id + from apm_package_types t, + apm_packages p + where t.singleton_p + and t.package_key = p.package_key + and t.package_key = :package_key}] + } { + # + # Instantiate package + # + set package_id [db_exec_plsql invoke_new {}] - set package_id [db_exec_plsql invoke_new {}] + apm_parameter_sync $package_key $package_id - apm_parameter_sync $package_key $package_id - - foreach inherited_package_key [nsv_get apm_package_inherit_order $package_key] { - apm_invoke_callback_proc \ - -package_key $inherited_package_key \ - -type after-instantiate \ - -arg_list [list package_id $package_id] + foreach inherited_package_key [nsv_get apm_package_inherit_order $package_key] { + apm_invoke_callback_proc \ + -package_key $inherited_package_key \ + -type after-instantiate \ + -arg_list [list package_id $package_id] + } } return $package_id