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.6 -r1.6.6.1 --- openacs-4/packages/acs-admin/www/apm/package-delete-2.tcl 11 Dec 2003 21:39:45 -0000 1.6 +++ openacs-4/packages/acs-admin/www/apm/package-delete-2.tcl 11 Oct 2005 23:55:28 -0000 1.6.6.1 @@ -25,13 +25,9 @@ doc_body_append [apm_header "Delete"] -db_transaction { - apm_package_delete -sql_drop_scripts $sql_drop_scripts -remove_files=0 -callback apm_doc_body_callback $package_key -} on_error { - if {[apm_package_registered_p $package_key] } { - doc_body_append "The database returned the following error - message
[ad_quotehtml $errmsg]
" - } +if { [catch {apm_package_delete -sql_drop_scripts $sql_drop_scripts -remove_files=0 -callback apm_doc_body_callback $package_key} errmsg] } { + doc_body_append "We encountered the following error when deleting package \"$package_key\": +
[ad_quotehtml $errmsg]
" } doc_body_append " 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.85.2.1 -r1.85.2.2 --- openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl 18 Jul 2005 17:41:03 -0000 1.85.2.1 +++ openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl 11 Oct 2005 23:55:29 -0000 1.85.2.2 @@ -28,7 +28,7 @@ } ### Scan for all unregistered .info files. - + ns_log Notice "apm_scan_packages: Scanning for new unregistered packages..." set new_spec_files [list] # Loop through all directories in the /packages directory, searching each for a @@ -125,7 +125,7 @@ } ad_proc -private pkg_info_new { package_key spec_file_path provides requires {dependency_p ""} {comment ""}} { - + Returns a datastructure that maintains information about a package. @param package_key The key of the package. @param spec_file_path The path to the package specification file @@ -156,8 +156,8 @@ } ad_proc -private pkg_info_path {pkg_info} { - + @return The full path of the packages dir stored in the package info map. Assumes that the info file is stored in the root dir of the package. @@ -386,11 +386,11 @@ available packages as returned by apm_get_package_repository. @return An array list with the following elements: - + @see apm_get_package_repository @@ -415,7 +415,7 @@ failed {} packages {} } - + # 'pending_packages' is an array keyed by package_key with a value of 1 for each package pending installation # When dependencies have been met, the entry will be unset array set pending_packages [list] @@ -812,7 +812,7 @@ apm_version_enable -callback $callback $version_id } - + # Instantiating, mounting, and after-install callback only invoked on initial install if { ! $upgrade_p } { # After install Tcl proc callback @@ -930,7 +930,7 @@ regsub {@.+} [cc_email_from_party [ad_get_user_id]] "" my_email_name set backup_dir "[apm_workspace_dir]/$package_key-removed-$my_email_name-[ns_fmttime [ns_time] "%Y%m%d-%H:%M:%S"]" - + apm_callback_and_log $callback "
  • Moving packages/$package_key to $backup_dir... " @@ -959,7 +959,7 @@ {-remove_files:boolean} package_key } { - + 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 @@ -970,58 +970,60 @@ # 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 - } + db_transaction { + 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 - } + # 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 + # Invoke the before-uninstall Tcl callback before the sql drop scripts + apm_invoke_callback_proc -version_id $version_id -type before-uninstall + # Unregister I18N messages + lang::catalog::package_delete -package_key $package_key + + # Remove package from APM tables + apm_callback_and_log $callback "
  • Deleting $package_key..." + db_exec_plsql apm_package_delete { + begin + apm_package_type.drop_type( + package_key => :package_key, + cascade_p => 't' + ); + end; + } + } + # Source SQL drop scripts if {![empty_string_p $sql_drop_scripts]} { apm_callback_and_log $callback "Now executing drop scripts.