Index: openacs-4/packages/general-comments/tcl/general-comments-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/general-comments/tcl/general-comments-procs.tcl,v diff -u -N -r1.25.2.3 -r1.25.2.4 --- openacs-4/packages/general-comments/tcl/general-comments-procs.tcl 23 Feb 2021 15:19:22 -0000 1.25.2.3 +++ openacs-4/packages/general-comments/tcl/general-comments-procs.tcl 23 Feb 2021 16:18:41 -0000 1.25.2.4 @@ -78,6 +78,22 @@ return $revision_id } +ad_proc -public general_comments_delete_messages { + -package_id:required +} { + Deletes all comments belonging to specified package. +} { + foreach comment_id [db_list get_comments { + select comment_id + from general_comments c, + acs_objects o + where c.comment_id = o.object_id + and o.package_id = :package_id + }] { + content::item::delete -item_id $comment_id + } +} + ad_proc -public general_comments_get_comments { { -print_content_p 0 } { -print_attachments_p 0 } Index: openacs-4/packages/xowiki/tcl/xowiki-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-callback-procs.tcl,v diff -u -N -r1.78.2.2 -r1.78.2.3 --- openacs-4/packages/xowiki/tcl/xowiki-callback-procs.tcl 8 Dec 2020 15:55:23 -0000 1.78.2.2 +++ openacs-4/packages/xowiki/tcl/xowiki-callback-procs.tcl 23 Feb 2021 16:18:41 -0000 1.78.2.3 @@ -36,7 +36,9 @@ @author Gustaf Neumann } { ns_log notice "Executing before-uninstantiate" - ::xowiki::delete_gc_messages -package_id $package_id + # Delete the messages of general comments to allow one to + # uninstantiate the package without violating constraints. + general_comments_delete_messages -package_id $package_id set root_folder_id [::xo::db::CrClass lookup -name "xowiki: $package_id" -parent_id -100] if {$root_folder_id ne "0"} { # we deal with a correctly installed package @@ -59,27 +61,6 @@ ns_log notice "before-uninstantiate DONE" } - - ad_proc -private ::xowiki::delete_gc_messages { - {-package_id:required} - } { - Deletes the messages of general comments to allow one to - uninstantiate the package without violating constraints. - - @author Gustaf Neumann - } { - set comment_ids [::xo::dc list get_comments { - select g.comment_id - from general_comments g, cr_items i,acs_objects o - where i.item_id = g.object_id - and o.object_id = i.item_id - and o.package_id = :package_id}] - foreach comment_id $comment_ids { - ::xo::db::sql::acs_message delete -message_id $comment_id - } - } - - # # upgrade logic #