site_node::delete (public)

 site_node::delete -node_id node_id [ -delete_subnodes ] \
    [ -delete_package ]

Defined in packages/acs-tcl/tcl/site-nodes-procs.tcl

delete the site node

Switches:
-node_id (required)
-delete_subnodes (optional, boolean)
-delete_package (optional, boolean)

Partial Call Graph (max 5 caller/called nodes):
%3 test_path_resolve path_resolve (test xowiki) site_node::delete site_node::delete test_path_resolve->site_node::delete test_site_node_update_cache site_node_update_cache (test acs-tcl) test_site_node_update_cache->site_node::delete test_slot_interactions slot_interactions (test xowiki) test_slot_interactions->site_node::delete test_xowiki_test_cases xowiki_test_cases (test xowiki) test_xowiki_test_cases->site_node::delete apm_package_instance_delete apm_package_instance_delete (public) site_node::delete->apm_package_instance_delete db_driverkey db_driverkey (public) site_node::delete->db_driverkey site_node::get_children site_node::get_children (public) site_node::delete->site_node::get_children site_node::get_object_id site_node::get_object_id (public) site_node::delete->site_node::get_object_id site_node::get_url site_node::get_url (public) site_node::delete->site_node::get_url acs::test::require_package_instance acs::test::require_package_instance (public) acs::test::require_package_instance->site_node::delete apm_package_delete apm_package_delete (public) apm_package_delete->site_node::delete navigation::test::context_bar_multirow_filter navigation::test::context_bar_multirow_filter (private) navigation::test::context_bar_multirow_filter->site_node::delete packages/acs-subsite/www/admin/applications/application-delete.tcl packages/acs-subsite/ www/admin/applications/application-delete.tcl packages/acs-subsite/www/admin/applications/application-delete.tcl->site_node::delete packages/acs-subsite/www/admin/site-map/delete.tcl packages/acs-subsite/ www/admin/site-map/delete.tcl packages/acs-subsite/www/admin/site-map/delete.tcl->site_node::delete

Testcases:
site_node_update_cache, xowiki_test_cases, slot_interactions, path_resolve
Source code:
    if {!$delete_subnodes_p} {
        set n_subnodes [llength [site_node::get_children  -node_id $node_id]]
        if {$n_subnodes != 0} {
            error "Site node has subnodes. To force use -delete_subnodes option"
        }
    }

    set nodes_to_delete {}

    # breadth-first visit of the node tree, so we can delete children
    # starting from leaves, then their parents and so on to the top
    # (and thus not triggering reference constraint errors)
    set queue [list $node_id]
    while {$queue ne ""} {
        set parent_id [lindex $queue 0]
        lappend nodes_to_delete $parent_id
        set queue [lrange $queue 1 end]
        lappend queue {*}[site_node::get_children  -element "node_id"  -node_id $parent_id]
    }

    # delete nodes in reverse order, starting from leaves
    foreach node_id [lreverse $nodes_to_delete] {
        # first delete package_id under this node...
        set package_id [site_node::get_object_id -node_id $node_id]
        set url [site_node::get_url -node_id $node_id]
        if {$delete_package_p} {
            apm_package_instance_delete $package_id
        }
        # ...then the node itself
        #
        # TODO: The names of the function in the database should be
        # aligned.
        #
        if {[db_driverkey ""] eq "oracle"} {
            acs::dc call site_node del -node_id $node_id
        } else {
            acs::dc call site_node delete -node_id $node_id
        }
        acs::dc call site_node delete -node_id $node_id
        update_cache -node_id $node_id -url $url -object_id $package_id
    }
Generic XQL file:
packages/acs-tcl/tcl/site-nodes-procs.xql

PostgreSQL XQL file:
packages/acs-tcl/tcl/site-nodes-procs-postgresql.xql

Oracle XQL file:
packages/acs-tcl/tcl/site-nodes-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: