Index: openacs-4/packages/acs-tcl/tcl/install-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/install-procs.tcl,v diff -u -r1.36 -r1.37 --- openacs-4/packages/acs-tcl/tcl/install-procs.tcl 12 Feb 2019 17:12:18 -0000 1.36 +++ openacs-4/packages/acs-tcl/tcl/install-procs.tcl 12 Feb 2019 17:28:59 -0000 1.37 @@ -16,19 +16,19 @@ ad_proc -public install::xml::action::text { node } { A documentation element which ignores its contents and does no processing. -} { +} { return {} } ad_proc -private ::install::xml::action::source { node } { - Source an install.xml file, sql file or Tcl script during execution of + Source an install.xml file, sql file or Tcl script during execution of the current install.xml. - If no type attribute is specified then this tag will attempt to guess - type of the sourced script from the file extension, otherwise it defaults + If no type attribute is specified then this tag will attempt to guess + type of the sourced script from the file extension, otherwise it defaults to install.xml. - The type of the sourced script may be explicitly declared as 'tcl', + The type of the sourced script may be explicitly declared as 'tcl', 'sql' or 'install.xml' using the type attribute. @author Lee Denison lee@xarg.co.uk @@ -82,7 +82,7 @@ } } - return $out + return $out } ad_proc -public install::xml::action::install { node } { @@ -101,7 +101,7 @@ Mounts a package on a specified node.

<mount package="package-key instance-name="name" mount-point="url" />

-} { +} { set package_key [apm_required_attribute_value $node package] set instance_name [apm_required_attribute_value $node instance-name] @@ -138,11 +138,11 @@ set parent_id [site_node::get_node_id -url "/$parent_url"] # technically this isn't safe - between us checking that the node exists - # and using it, the node may have been deleted. + # and using it, the node may have been deleted. # We could "select for update" but since it's in a memory cache anyway, # it won't help us very much! # Instead we just press on and if there's an error handle it at the top level. - + # create the node and reget iff it doesn't exist if { [catch { array set site_node [site_node::get_from_url -exact -url "/$mount_point"] } error] } { set node_id [site_node::new -name $leaf_url -parent_id $parent_id] @@ -189,7 +189,7 @@ Mounts an existing package on a specified node.

<mount-existing package-id="package-id mount-point="url" />

-} { +} { set package_id [apm_attribute_value -default "" $node package-id] set package_key [apm_attribute_value -default "" $node package-key] set mount_point [apm_attribute_value -default "" $node mount-point] @@ -216,17 +216,17 @@ set parent_id [site_node::get_node_id -url "/$parent_url"] # technically this isn't safe - between us checking that the node exists - # and using it, the node may have been deleted. + # and using it, the node may have been deleted. # We could "select for update" but since it's in a memory cache anyway, # it won't help us very much! # Instead we just press on and if there's an error handle it at the top level. - + # create the node and reget iff it doesn't exist if { [catch { array set site_node [site_node::get_from_url -exact -url "/$mount_point"] } error] } { set node_id [site_node::new -name $leaf_url -parent_id $parent_id] array set site_node [site_node::get_from_url -exact -url "/$mount_point"] } - + # There now definitely a node with that path if {$site_node(object_id) eq ""} { # no package mounted - good! @@ -245,7 +245,7 @@ set package_id [install::xml::util::get_id $package_id] } elseif {$package_key ne ""} { set package_id [apm_package_id_from_key $package_key] - } + } set package_id [site_node::mount \ -node_id $node_id \ @@ -261,7 +261,7 @@

<rename-instance package-id="package-id" url="url" instance-name="new instance name" />

-} { +} { set package_id [apm_attribute_value -default "" $node package-id] set url [apm_attribute_value -default "" $node url] set instance_name [apm_required_attribute_value $node instance-name] @@ -315,7 +315,7 @@ Registers a package parameter.

<register-parameter name="parameter" description="description" package-key="package-key" scope="instance or global" default-value="default-value" datatype="datatype" [ [ [ section="section" ] min-n-values="min-n-values" ] max-n-values="max-n-values" ] [ callback="callback" ] [ parameter-id="parameter-id" ]

-} { +} { set name [apm_required_attribute_value $node name] set desc [apm_required_attribute_value $node description] set package_key [apm_required_attribute_value $node package-key] @@ -360,7 +360,7 @@ Sets a package parameter.

<set-parameter name="parameter" [ package="package-key | url="package-url" ] type="[id|literal]" value="value" />

-} { +} { variable ::install::xml::ids set name [apm_required_attribute_value $node name] @@ -370,19 +370,19 @@ set package_ids [install::xml::object_id::package $node] foreach package_id $package_ids { - switch -- $type { - literal { - parameter::set_value -package_id $package_id \ - -parameter $name \ - -value $value - } + switch -- $type { + literal { + parameter::set_value -package_id $package_id \ + -parameter $name \ + -value $value + } - id { - parameter::set_value -package_id $package_id \ - -parameter $name \ - -value $ids($value) - } - } + id { + parameter::set_value -package_id $package_id \ + -parameter $name \ + -value $ids($value) + } + } } return } @@ -407,7 +407,7 @@ Sets permissions on an object.

<set-permissions grantee="party" privilege="package-key />

-} { +} { set privileges [apm_required_attribute_value $node privilege] set privilege_list [split $privileges ","] @@ -417,7 +417,7 @@ foreach grantee $grantees { set party_id [apm_invoke_install_proc -type object_id -node $grantee] - + set objects_node [xml_node_get_children_by_name [lindex $node 0] object] set objects [xml_node_get_children [lindex $objects_node 0]] @@ -436,11 +436,11 @@ } ad_proc -public install::xml::action::unset-permission { node } { - Revokes a permissions on an object - has no effect if the permission is not granted directly + Revokes a permissions on an object - has no effect if the permission is not granted directly (ie does not act as negative permissions).

<unset-permissions grantee="party" privilege="package-key />

-} { +} { set privileges [apm_required_attribute_value $node privilege] set privilege_list [split $privileges ","] @@ -450,7 +450,7 @@ foreach grantee $grantees { set party_id [apm_invoke_install_proc -type object_id -node $grantee] - + set objects_node [xml_node_get_children_by_name [lindex $node 0] object] set objects [xml_node_get_children [lindex $objects_node 0]] @@ -489,7 +489,7 @@ Create a new user. local-p should be set to true when this action is used in - the bootstrap install.xml - this ensures we call the + the bootstrap install.xml - this ensures we call the auth::local api directly while the service contract has not been setup. } { @@ -576,7 +576,7 @@ WHERE user_id = :user_id } } - + if {$id ne ""} { set ::install::xml::ids($id) $result(user_id) } @@ -706,7 +706,7 @@ -extension $extension \ -package_id $package \ -context_id $context] - } + } if {$id ne ""} { set ::install::xml::ids($id) $result @@ -772,7 +772,7 @@ set value [apm_attribute_value -default "" $child value] set type [apm_attribute_value -default literal $child type] set subtree_p [apm_attribute_value -default f $child subtree-p] - + set subtree_p [template::util::is_true $subtree_p] if {$type eq "id"} { @@ -789,7 +789,7 @@ set url [apm_required_attribute_value $child url] set exports [apm_attribute_value -default "" $child exports] set subtree_p [apm_attribute_value -default f $child subtree-p] - + set subtree_p [template::util::is_true $subtree_p] location::parameter::create -location_id $location_id \ @@ -811,12 +811,12 @@ xml_node_set_attribute $child path-arg $child_arg } - if {$package ne "" + if {$package ne "" && ![xml_node_has_attribute $child package-id]} { xml_node_set_attribute $child package-id $package } - if {$context ne "" + if {$context ne "" && ![xml_node_has_attribute $child context-id]} { xml_node_set_attribute $child context-id $parent_id } @@ -846,7 +846,7 @@ set title [apm_attribute_value -default "" $node title] set child_arg [apm_attribute_value -default "" $node child-arg] set process [apm_attribute_value -default "" $node process] - + if {$context ne ""} { set context [install::xml::util::get_id $context] } @@ -864,14 +864,14 @@ -path_arg "" \ -package_id $package \ -context_id $context] - + if {$process ne ""} { location::parameter::create -location_id $parent_id \ -name "wizard::process" \ -subtree_p t \ -value $process } - + set steps [xml_node_get_children [lindex $node 0]] foreach step $steps { @@ -888,12 +888,12 @@ xml_node_set_attribute $step path-arg $child_arg } - if {$package ne "" + if {$package ne "" && ![xml_node_has_attribute $step package-id]} { xml_node_set_attribute $step package-id $package } - if {$context ne "" + if {$context ne "" && ![xml_node_has_attribute $step context-id]} { xml_node_set_attribute $step context-id $parent_id } @@ -991,7 +991,7 @@ Instantiate an object using package_instantiate_object. This will work for both PostgreSQL and Oracle if the proper object package and new() function have been defined. - + @author Don Baccus donb@pacifier.com @creation-date 2008-12-04 @@ -1028,7 +1028,7 @@ ad_proc -public install::xml::object_id::package { node } { Returns an object_id for a package specified in node. - The node name is ignored so any node which provides the correct + The node name is ignored so any node which provides the correct attributes may be used.

<package [ id="id" | key="package-key" | url="package-url" ] />

@@ -1065,14 +1065,14 @@ ad_proc -public install::xml::object_id::group { node } { Returns an object_id for a group or relational segment. - The node name is ignored so any node which provides the correct + The node name is ignored so any node which provides the correct attributes may be used.

<group id="group_id" [ type="group type" relation="relation-type" ] />

} { set group_type [apm_attribute_value -default "group" $node type] set relation_type [apm_attribute_value -default "membership_rel" $node relation] - + if {$group_type eq "group"} { set id [apm_required_attribute_value $node group-id] } elseif {$group_type eq "rel_segment"} { @@ -1125,7 +1125,7 @@ ad_proc -public install::xml::object_id::object { node } { Returns a literal object_id for an object. - + use <object id="-100"> to return the literal id -100. } { set id [apm_required_attribute_value $node id] @@ -1146,7 +1146,7 @@ variable ::install::xml::ids set ids($name) $value } - + ad_proc -public install::xml::util::get_id { id } { Returns an id from the global ids variable if it exists and attempts to find an acs_magic_object if not. @@ -1164,7 +1164,7 @@ } err]} { error "$id is not an integer, is not defined in this install.xml, and is not an acs_magic_object" } - + return $result }