Index: openacs-4/packages/chat/tcl/chat-ajax-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/tcl/chat-ajax-procs.tcl,v diff -u -N -r1.23.2.12 -r1.23.2.13 --- openacs-4/packages/chat/tcl/chat-ajax-procs.tcl 8 Apr 2020 12:02:18 -0000 1.23.2.12 +++ openacs-4/packages/chat/tcl/chat-ajax-procs.tcl 3 Oct 2021 17:38:48 -0000 1.23.2.13 @@ -72,7 +72,7 @@ select room_id, to_char(max(creation_date),'HH24:MI:SS YYYY-MM-DD') as last_activity from chat_msgs group by room_id } { - ::xo::clusterwide nsv_set [self]-$room_id-seen last [clock scan $last_activity] + ::acs::clusterwide nsv_set [self]-$room_id-seen last [clock scan $last_activity] } } Index: openacs-4/packages/xooauth/tcl/package-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xooauth/tcl/Attic/package-procs.tcl,v diff -u -N -r1.1.2.2 -r1.1.2.3 --- openacs-4/packages/xooauth/tcl/package-procs.tcl 10 Nov 2020 08:44:57 -0000 1.1.2.2 +++ openacs-4/packages/xooauth/tcl/package-procs.tcl 3 Oct 2021 17:38:49 -0000 1.1.2.3 @@ -73,7 +73,7 @@ } } set p [::xo::oauth::Package initialize -url "/oauth"] - ::xo::clusterwide ns_cache flush xotcl_object_type_cache root_folder-[$p id] + ::acs::clusterwide ns_cache flush xotcl_object_type_cache root_folder-[$p id] ::content::folder::delete -folder_id [$p folder_id] } Index: openacs-4/packages/xotcl-core/tcl/cluster-init.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/tcl/cluster-init.tcl,v diff -u -N --- openacs-4/packages/xotcl-core/tcl/cluster-init.tcl 26 Aug 2020 18:50:43 -0000 1.5.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,44 +0,0 @@ -if {[server_cluster_enabled_p]} { - set my_ip [ns_config ns/server/[ns_info server]/module/nssock Address] - set my_port [ns_config ns/server/[ns_info server]/module/nssock port] - - foreach host [server_cluster_all_hosts] { - set port 80 - regexp {^(.*):(.*)} $host _ host port - if {"$host-$port" eq "$my_ip-$my_port"} continue - ::xo::Cluster create CS_${host}_$port -host $host -port $port - } - - foreach ip [parameter::get -package_id [ad_acs_kernel_id] -parameter ClusterAuthorizedIP] { - if {[string first * $ip] > -1} { - ::xo::Cluster lappend allowed_host_patterns $ip - } else { - ::xo::Cluster set allowed_host($ip) 1 - } - } - - set url [::xo::Cluster set url] - - # Check, if the filter url mirrors a site node. If so, - # the cluster mechanism will not work, if the site node - # requires a login. Clustering will only work if the - # root node is freely accessible. - - array set node [site_node::get -url $url] - if {$node(url) ne "/"} { - ns_log notice "***\n*** WARNING: there appears a package mounted on\ - $url\n***Cluster configuration will not work\ - since there is a conflict with the AOLserver filter with the same name!\n" - } - - #ns_register_filter trace GET $url ::xo::Cluster - ns_register_filter preauth GET $url ::xo::Cluster - #ad_register_filter -priority 900 preauth GET $url ::xo::Cluster -} - -# -# Local variables: -# mode: tcl -# tcl-indent-level: 2 -# indent-tabs-mode: nil -# End: Index: openacs-4/packages/xotcl-core/tcl/cluster-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/tcl/cluster-procs.tcl,v diff -u -N -r1.13.2.1 -r1.13.2.2 --- openacs-4/packages/xotcl-core/tcl/cluster-procs.tcl 26 Aug 2020 18:50:43 -0000 1.13.2.1 +++ openacs-4/packages/xotcl-core/tcl/cluster-procs.tcl 3 Oct 2021 17:38:49 -0000 1.13.2.2 @@ -1,5 +1,5 @@ ::xo::library doc { - XOTcl cluster support + XOTcl cluster support (deprecated code, moved into ::acs::* namespace) @author Gustaf Neumann @creation-date 2007-07-19 @@ -8,135 +8,27 @@ namespace eval ::xo { - proc clusterwide args { - # first, execute the command on the local server - eval $args - # then, distribute the command in the cluster - ::xo::Cluster broadcast {*}$args + ad_proc -deprecated clusterwide args { + Execute a command on every machine in a cluster. + The command was moved into the ::acs::* namespace. + } { + ::acs::clusterwide {*}$args } - proc cache_flush_all {cache pattern} { - # Provide means to perform a wildcard-based cache flushing on - # (cluster) machines. - foreach n [ns_cache names $cache $pattern] {ns_cache flush $cache $n} + ad_proc -deprecated cache_flush_all {cache pattern} { + Provide means to perform a wildcard-based cache flushing on + (cluster) machines. } - - Class create Cluster -parameter {host {port 80}} - Cluster set allowed_host_patterns [list] - Cluster set url /xotcl-cluster-do - Cluster array set allowed_host { - "127.0.0.1" 1 + ::acs::cache_flush_all $cache $pattern } - # - # The allowed commands are of the form - # - command names followed by - # - optional "except patterns" - # - Cluster array set allowed_command { - set "" - unset "" - nsv_set "" - nsv_unset "" - nsv_incr "" - bgdelivery "" - ns_cache "^ns_cache\s+eval" - ns_cache_flush "" - xo::cache_flush_all "" - } - # - # Prevent unwanted object generations for unknown - # arguments of ::xo::Cluster. - # - Cluster proc unknown args { - error "[self] received unknown method $args" - } - # - # handling the ns_filter methods - # - Cluster proc trace args { - :log "" - return filter_return - } - Cluster proc preauth args { - :log "" - :incoming_request - return filter_return - } - Cluster proc postauth args { - :log "" - return filter_return - } - # - # handle incoming request issues - # - Cluster proc incoming_request {} { - set cmd [ns_queryget cmd] - set addr [lindex [ns_set iget [ns_conn headers] x-forwarded-for] end] - if {$addr eq ""} {set addr [ns_conn peeraddr]} - #ns_log notice "--cluster got cmd='$cmd' from $addr" - ad_try { - set result [::xo::Cluster execute [ns_conn peeraddr] $cmd] - } on error {errorMsg} { - ns_log notice "--cluster error: $errorMsg" - ns_return 417 text/plain $errorMsg - } on ok {r} { - #ns_log notice "--cluster success $result" - ns_return 200 text/plain $result - } - } - Cluster proc execute {host cmd} { - if {![info exists :allowed_host($host)]} { - set ok 0 - foreach g ${:allowed_host_patterns} { - if {[string match $g $host]} { - set ok 1 - break - } - } - if {!$ok} { - error "refuse to execute commands from $host (command: '$cmd')" - } - } - set cmd_name [lindex $cmd 0] - set key allowed_command($cmd_name) - #ns_log notice "--cluster $key exists ? [info exists :$key]" - if {[info exists :$key]} { - set except_RE [set :$key] - #ns_log notice "--cluster [list regexp $except_RE $cmd] -> [regexp $except_RE $cmd]" - if {$except_RE eq "" || ![regexp $except_RE $cmd]} { - ns_log notice "--cluster executes command '$cmd' from host $host" - return [eval $cmd] - } - } - error "command '$cmd' from host $host not allowed" + ad_proc -deprecated Cluster args { + Create a cluster node. The command was moved into the ::acs::* + namespace. + } { + ::acs::Cluster {*}$args } - # - # handline outgoing request issues - # - Cluster proc broadcast args { - foreach server [:info instances] { - $server message {*}$args - } - } - Cluster instproc message args { - :log "--cluster outgoing request to [:host]:[:port] // $args" - # set r [::xo::HttpRequest new -volatile \ - # -host [:host] -port [:port] \ - # -path [Cluster set url]?cmd=[ns_urlencode $args]] - # return [$r set data] - - set r [::xo::AsyncHttpRequest new -volatile \ - -host [:host] -port [:port] \ - -path [Cluster set url]?cmd=[ns_urlencode $args]] - - # ::bgdelivery do ::xo::AsyncHttpRequest new \ - # -host [:host] -port [:port] \ - # -path [Cluster set url]?cmd=[ns_urlencode $args] \ - # -mixin ::xo::AsyncHttpRequest::SimpleListener \ - # -proc finalize {obj status value} { :destroy } - - } + } ::xo::library source_dependent Index: openacs-4/packages/xowiki/tcl/chat-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/chat-procs.tcl,v diff -u -N -r1.54.2.20 -r1.54.2.21 --- openacs-4/packages/xowiki/tcl/chat-procs.tcl 28 Sep 2020 21:04:04 -0000 1.54.2.20 +++ openacs-4/packages/xowiki/tcl/chat-procs.tcl 3 Oct 2021 17:38:49 -0000 1.54.2.21 @@ -51,15 +51,15 @@ if {![nsv_exists $cls initialized]} { :log "-- initialize $cls" $cls initialize_nsvs - ::xo::clusterwide nsv_set $cls initialized \ + ::acs::clusterwide nsv_set $cls initialized \ [ad_schedule_proc \ -thread "t" [:sweepinterval] $cls sweep_all_chats] } if {![nsv_exists ${:array}-seen newest]} { - ::xo::clusterwide nsv_set ${:array}-seen newest 0 + ::acs::clusterwide nsv_set ${:array}-seen newest 0 } if {![nsv_exists ${:array}-color idx]} { - ::xo::clusterwide nsv_set ${:array}-color idx 0 + ::acs::clusterwide nsv_set ${:array}-color idx 0 } if {${:user_id} != 0 || [:session_id] != 0} { :init_user_color @@ -69,7 +69,7 @@ Chat instproc set_options {} { dict for {key value} ${:conf} { - ::xo::clusterwide nsv_set ${:array}-options $key $value + ::acs::clusterwide nsv_set ${:array}-options $key $value } foreach {key value} [nsv_array get ${:array}-options] { set :$key $value @@ -79,12 +79,12 @@ Chat instproc register_nsvs {msg_id user_id msg color secs} { # Tell the system we are back again, in case we were auto logged out if { ![nsv_exists ${:array}-login $user_id] } { - ::xo::clusterwide nsv_set ${:array}-login $user_id [clock seconds] + ::acs::clusterwide nsv_set ${:array}-login $user_id [clock seconds] } - ::xo::clusterwide nsv_set ${:array} $msg_id [list ${:now} $secs $user_id $msg $color] - ::xo::clusterwide nsv_set ${:array}-seen newest ${:now} - ::xo::clusterwide nsv_set ${:array}-seen last $secs - ::xo::clusterwide nsv_set ${:array}-last-activity $user_id ${:now} + ::acs::clusterwide nsv_set ${:array} $msg_id [list ${:now} $secs $user_id $msg $color] + ::acs::clusterwide nsv_set ${:array}-seen newest ${:now} + ::acs::clusterwide nsv_set ${:array}-seen last $secs + ::acs::clusterwide nsv_set ${:array}-last-activity $user_id ${:now} } Chat instproc add_msg {{-get_new:boolean true} {-uid ""} msg} { @@ -129,7 +129,7 @@ Chat instproc check_age {key ago} { if {$ago > ${:timewindow}} { - ::xo::clusterwide nsv_unset ${:array} $key + ::acs::clusterwide nsv_unset ${:array} $key #:log "--c unsetting $key" return 0 } @@ -171,7 +171,7 @@ :check_age $key [expr {(${:now} - $timestamp) / 1000}] } } - ::xo::clusterwide nsv_set ${:array}-seen ${:session_id} ${:now} + ::acs::clusterwide nsv_set ${:array}-seen ${:session_id} ${:now} # :log "--chat setting session_id ${:session_id}: ${:now}" } else { # :log "--chat nothing new for ${:session_id}" @@ -187,7 +187,7 @@ } } #:log "--chat setting session_id ${:session_id}: ${:now}" - ::xo::clusterwide nsv_set ${:array}-seen ${:session_id} ${:now} + ::acs::clusterwide nsv_set ${:array}-seen ${:session_id} ${:now} :render } @@ -217,13 +217,13 @@ # These values could already not be here. Just ignore when we don't # find them try { - ::xo::clusterwide nsv_unset -nocomplain ${:array}-login $user_id + ::acs::clusterwide nsv_unset -nocomplain ${:array}-login $user_id } try { - ::xo::clusterwide nsv_unset -nocomplain ${:array}-color $user_id + ::acs::clusterwide nsv_unset -nocomplain ${:array}-color $user_id } try { - ::xo::clusterwide nsv_unset -nocomplain ${:array}-last-activity $user_id + ::acs::clusterwide nsv_unset -nocomplain ${:array}-last-activity $user_id } } @@ -234,8 +234,8 @@ set colors [::xo::parameter get -parameter UserColors -default [[:info class] set colors]] # ns_log notice "getting colors of [:info class] = [info exists colors]" set color [lindex $colors [expr { [nsv_get ${:array}-color idx] % [llength $colors] }]] - ::xo::clusterwide nsv_set ${:array}-color ${:user_id} $color - ::xo::clusterwide nsv_incr ${:array}-color idx + ::acs::clusterwide nsv_set ${:array}-color ${:user_id} $color + ::acs::clusterwide nsv_incr ${:array}-color idx } } @@ -256,8 +256,8 @@ } elseif {${:user_id} > 0 && ![nsv_exists ${:array}-login ${:user_id}]} { # give some proof of our presence to the chat system when we # don't issue the login message - ::xo::clusterwide nsv_set ${:array}-login ${:user_id} [clock seconds] - ::xo::clusterwide nsv_set ${:array}-last-activity ${:user_id} ${:now} + ::acs::clusterwide nsv_set ${:array}-login ${:user_id} [clock seconds] + ::acs::clusterwide nsv_set ${:array}-last-activity ${:user_id} ${:now} } :encoder noencode #:log "--chat setting session_id ${:session_id}: ${:now} mode=${:mode}" @@ -384,9 +384,9 @@ ChatClass method flush_messages {-chat_id:required} { set array "[self]-$chat_id" - ::xo::clusterwide nsv_unset -nocomplain $array - ::xo::clusterwide nsv_unset -nocomplain $array-seen - ::xo::clusterwide nsv_unset -nocomplain $array-last-activity + ::acs::clusterwide nsv_unset -nocomplain $array + ::acs::clusterwide nsv_unset -nocomplain $array-seen + ::acs::clusterwide nsv_unset -nocomplain $array-last-activity } ChatClass method init {} { Index: openacs-4/packages/xowiki/tcl/link-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/link-procs.tcl,v diff -u -N -r1.106.2.17 -r1.106.2.18 --- openacs-4/packages/xowiki/tcl/link-procs.tcl 2 Sep 2021 13:24:28 -0000 1.106.2.17 +++ openacs-4/packages/xowiki/tcl/link-procs.tcl 3 Oct 2021 17:38:49 -0000 1.106.2.18 @@ -633,12 +633,12 @@ # Class create LinkCache # LinkCache proc flush {parent_id {item_id ""}} { # if {$item_id eq ""} { - # :xo::clusterwide xo::cache_flush_all xowiki_cache link-*-$name-$parent_id + # :acs::clusterwide acs::cache_flush_all xowiki_cache link-*-$name-$parent_id # } else { # foreach entry [ns_cache names xowiki_cache link-*-$parent_id] { # array set tmp [ns_cache get xowiki_cache $entry] # if {$tmp(item_id) == $item_id} { - # ::xo::clusterwide ns_cache flush xowiki_cache $entry + # ::acs::clusterwide ns_cache flush xowiki_cache $entry # } # } # }