xowiki::before-uninstantiate (public)

 xowiki::before-uninstantiate -package_id package_id

Defined in packages/xowiki/tcl/xowiki-callback-procs.tcl

Callback to be called whenever a package instance is deleted.

Switches:
-package_id
(required)
Author:
Gustaf Neumann

Partial Call Graph (max 5 caller/called nodes):
%3 test_xowiki_test_cases xowiki_test_cases (test xowiki) xowiki::before-uninstantiate xowiki::before-uninstantiate test_xowiki_test_cases->xowiki::before-uninstantiate apm_instance_name_from_id apm_instance_name_from_id (public) xowiki::before-uninstantiate->apm_instance_name_from_id general_comments_delete_messages general_comments_delete_messages (public) xowiki::before-uninstantiate->general_comments_delete_messages

Testcases:
xowiki_test_cases
Source code:
    ns_log notice "Executing before-uninstantiate"
    # 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
      if {[::xo::dc 0or1row is_transformed_folder {
        select 1 from cr_folders where folder_id = :root_folder_id}
          ]} {
        ::xo::db::sql::content_folder delete -folder_id $root_folder_id -cascade_p 1
      } else {
        ::xo::db::sql::content_item delete -item_id $root_folder_id
      }
    }

    set instance_name [apm_instance_name_from_id $package_id]

    ::xo::xotcl_package_cache flush package_id-$instance_name
    ::xo::xotcl_package_cache flush package_key-$package_id
    ::xo::xotcl_package_cache flush root_folder-$package_id
    ::xo::xotcl_object_type_cache flush -partition_key -100 -100-$instance_name

    ns_log notice "before-uninstantiate DONE"
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: