Index: openacs-4/packages/acs-admin/www/apm/package-delete-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/package-delete-2.tcl,v diff -u -N -r1.5 -r1.5.2.1 --- openacs-4/packages/acs-admin/www/apm/package-delete-2.tcl 17 May 2003 09:36:29 -0000 1.5 +++ openacs-4/packages/acs-admin/www/apm/package-delete-2.tcl 25 Nov 2003 12:45:16 -0000 1.5.2.1 @@ -23,47 +23,10 @@ apm_version_info $version_id -doc_body_append [apm_header [list "version-view?version_id=$version_id" "$pretty_name $version_name"] "Delete"] +doc_body_append [apm_header "Delete"] -# Unmount all instances of this package with the Tcl API that invokes before-unmount callbacks -db_foreach all_package_instances { - select site_nodes.node_id - from apm_packages, site_nodes - where apm_packages.package_id = site_nodes.object_id - and apm_packages.package_key = :package_key -} { - set url [site_node::get_url -node_id $node_id] - doc_body_append "Unmounting package instance at url $url
" - site_node::unmount -node_id $node_id -} - -# Delete the package instances with Tcl API that invokes before-uninstantiate callbacks -db_foreach all_package_instances { - select package_id - from apm_packages - where package_key = :package_key -} { - doc_body_append "Deleting package instance $package_id
" - apm_package_instance_delete $package_id -} - -# Invoke the before-uninstall Tcl callback before the sql drop scripts -apm_invoke_callback_proc -version_id $version_id -type before-uninstall - -if {![empty_string_p $sql_drop_scripts]} { - - doc_body_append "Now executing drop scripts. -

-Return to the index. +

You should restart the server now to make sure the memory footprint and cache of the package is cleared out. Click here to restart the server now.

[ad_footer] " Index: openacs-4/packages/acs-lang/tcl/lang-catalog-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/tcl/lang-catalog-procs.tcl,v diff -u -N -r1.36 -r1.36.2.1 --- openacs-4/packages/acs-lang/tcl/lang-catalog-procs.tcl 1 Nov 2003 08:45:36 -0000 1.36 +++ openacs-4/packages/acs-lang/tcl/lang-catalog-procs.tcl 25 Nov 2003 12:45:17 -0000 1.36.2.1 @@ -765,6 +765,35 @@ ################## # +# Mischellaneous procs +# +################## + +ad_proc -public lang::catalog::package_delete { + {-package_key:required} +} { + Unregister the I18N messages for the package. + + @author Peter Marklund +} { + set message_key_list [db_list all_message_keys_for_package { + select message_key + from lang_message_keys + where package_key = :package_key + }] + + db_dml delete_package_keys { + delete from lang_message_keys + where package_key = :package_key + } + + foreach message_key $message_key_list { + lang::message::remove_from_cache $package_key $message_key + } +} + +################## +# # Inactive and unmaintained procs # ################## Index: openacs-4/packages/acs-lang/tcl/lang-message-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/tcl/lang-message-procs.tcl,v diff -u -N -r1.39.2.1 -r1.39.2.2 --- openacs-4/packages/acs-lang/tcl/lang-message-procs.tcl 24 Nov 2003 17:54:05 -0000 1.39.2.1 +++ openacs-4/packages/acs-lang/tcl/lang-message-procs.tcl 25 Nov 2003 12:45:17 -0000 1.39.2.2 @@ -172,8 +172,25 @@ and package_key = :package_key } + remove_from_cache $package_key $message_key +} + +ad_proc -private lang::message::remove_from_cache { + package_key + message_key +} { + Delete a certain message key from the cache for all + locales. + + @author Peter Marklund +} { + set locales_list [db_list select_system_locales { + select locale + from ad_locales + }] + # Delete from the cache for all enabled locales - foreach locale [lang::system::get_locales] { + foreach locale $locales_list { set nsv_array lang_message_$locale set nsv_key "${package_key}.${message_key}" if { [nsv_exists $nsv_array $nsv_key] } { @@ -504,6 +521,7 @@ set i 0 db_foreach select_locale_keys {} { + ns_log Notice "pm debug ${package_key}.${message_key} $message" nsv_set lang_message_$locale "${package_key}.${message_key}" $message incr i } Index: openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl,v diff -u -N -r1.69.2.1 -r1.69.2.2 --- openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl 24 Nov 2003 17:43:15 -0000 1.69.2.1 +++ openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl 25 Nov 2003 12:45:17 -0000 1.69.2.2 @@ -735,6 +735,7 @@ # We are upgrading a package # Load catalog files with upgrade switch before package version is changed in db + ns_log Notice "pm debug upgrading loading catalog files" apm_load_catalog_files -upgrade $package_key set version_id [apm_package_install_version -callback $callback $package_key $version_name \ @@ -745,6 +746,7 @@ } else { # We are installing a new package + ns_log Notice "pm debug installing loading catalog files" apm_load_catalog_files $package_key set version_id [apm_package_install_version \ @@ -918,16 +920,66 @@ } ad_proc -private apm_package_delete { + {-sql_drop_scripts ""} { -callback apm_dummy_callback } {-remove_files:boolean} package_key } { - Deinstalls and deletes a package from the ACS and the filesystem. + Deinstall a package from the system. Will unmount and uninstantiate + package instances, invoke any before-unstall callback, source any + provided sql drop scripts, remove message keys, and delete + the package from the APM tables. } { + set version_id [apm_version_id_from_package_key $package_key] + + # Unmount all instances of this package with the Tcl API that + # invokes before-unmount callbacks + db_foreach all_package_instances { + select site_nodes.node_id + from apm_packages, site_nodes + where apm_packages.package_id = site_nodes.object_id + and apm_packages.package_key = :package_key + } { + set url [site_node::get_url -node_id $node_id] + apm_callback_and_log $callback "Unmounting package instance at url $url
" + site_node::unmount -node_id $node_id + } + + # Delete the package instances with Tcl API that invokes + # before-uninstantiate callbacks + db_foreach all_package_instances { + select package_id + from apm_packages + where package_key = :package_key + } { + apm_callback_and_log $callback "Deleting package instance $package_id
" + apm_package_instance_delete $package_id + } + + # Invoke the before-uninstall Tcl callback before the sql drop scripts + apm_invoke_callback_proc -version_id $version_id -type before-uninstall + + # Source SQL drop scripts + if {![empty_string_p $sql_drop_scripts]} { + + apm_callback_and_log $callback "Now executing drop scripts. +