Index: openacs-4/packages/xotcl-request-monitor/tcl/throttle_mod-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-request-monitor/tcl/throttle_mod-procs.tcl,v diff -u -r1.67.2.11 -r1.67.2.12 --- openacs-4/packages/xotcl-request-monitor/tcl/throttle_mod-procs.tcl 6 Apr 2020 11:28:24 -0000 1.67.2.11 +++ openacs-4/packages/xotcl-request-monitor/tcl/throttle_mod-procs.tcl 6 Apr 2020 17:16:59 -0000 1.67.2.12 @@ -1795,6 +1795,30 @@ } } + ad_proc -private request_monitor_user_info {key} { + } { + if {[string is integer $key]} { + # + # It looks like a user_id + # + set person [person::get_person_info -person_id $key] + if {[dict exists $person last_name]} { + set user_label "[dict get $person last_name], [dict get $person first_names]" + set user_url [acs_community_member_url -user_id $key] + } else { + # + # Maybe, the user was deleted in the meanwhile + # + set user_label "Unknown user_id $key" + set user_url "" + } + } else { + # it was an IP address + set user_label $user_id + set user_url "" + } + return [list label $user_label url $user_url] + } proc request_monitor_record_activity {key pa seconds clicks reason} { if {[::xo::is_ip $key]} { Index: openacs-4/packages/xotcl-request-monitor/www/active-communities.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-request-monitor/www/active-communities.tcl,v diff -u -r1.4 -r1.4.2.1 --- openacs-4/packages/xotcl-request-monitor/www/active-communities.tcl 29 Jun 2018 17:27:19 -0000 1.4 +++ openacs-4/packages/xotcl-request-monitor/www/active-communities.tcl 6 Apr 2020 17:16:59 -0000 1.4.2.1 @@ -34,7 +34,7 @@ if {$community_name eq ""} { set community_name [::xo::db::sql::apm_package name -package_id $community_id] } - + t1 add \ -community $community_name \ -community.href [export_vars -base users-in-community {community_id community_name}] \ Index: openacs-4/packages/xotcl-request-monitor/www/flush-url-statistics.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-request-monitor/www/flush-url-statistics.tcl,v diff -u -r1.3 -r1.3.2.1 --- openacs-4/packages/xotcl-request-monitor/www/flush-url-statistics.tcl 7 Aug 2017 23:48:30 -0000 1.3 +++ openacs-4/packages/xotcl-request-monitor/www/flush-url-statistics.tcl 6 Apr 2020 17:16:59 -0000 1.3.2.1 @@ -1,6 +1,6 @@ ad_page_contract { delete a revision of the content repository - + @author Gustaf Neumann (gustaf.neumann@wu-wien.ac.at) @creation-date Oct 23, 2005 @cvs-id $Id$ Index: openacs-4/packages/xotcl-request-monitor/www/ip-info.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-request-monitor/www/ip-info.tcl,v diff -u -r1.4 -r1.4.2.1 --- openacs-4/packages/xotcl-request-monitor/www/ip-info.tcl 29 Jun 2018 17:27:19 -0000 1.4 +++ openacs-4/packages/xotcl-request-monitor/www/ip-info.tcl 6 Apr 2020 17:16:59 -0000 1.4.2.1 @@ -14,7 +14,7 @@ set title "IP Lookup" set context [list $title] -if {[catch {set dns_name [ns_hostbyaddr $ip]}]} { set dns_name "DNS lookup for $ip failed" } +if {[catch {set dns_name [ns_hostbyaddr $ip]}]} { set dns_name "DNS lookup for $ip failed" } # Local variables: Index: openacs-4/packages/xotcl-request-monitor/www/last-requests.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-request-monitor/www/last-requests.tcl,v diff -u -r1.11.2.3 -r1.11.2.4 --- openacs-4/packages/xotcl-request-monitor/www/last-requests.tcl 25 Jan 2020 14:15:14 -0000 1.11.2.3 +++ openacs-4/packages/xotcl-request-monitor/www/last-requests.tcl 6 Apr 2020 17:16:59 -0000 1.11.2.4 @@ -18,9 +18,9 @@ set hide_patterns [parameter::get -parameter hide-requests -default {*.css}] if {[string is integer $request_key]} { - set person [person::get_person_info -person_id $request_key] - set user_string "[dict get $person first_names] [dict get $person last_name]" - set tmp_url [acs_community_member_url -user_id $request_key] + set user_info [xo::request_monitor_user_info $request_key] + set user_string [dict get $user_info label] + set tmp_url [dict get $user_info url] append user_string " ($request_key)" } else { set user_string $request_key Index: openacs-4/packages/xotcl-request-monitor/www/last100.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-request-monitor/www/last100.tcl,v diff -u -r1.12.2.2 -r1.12.2.3 --- openacs-4/packages/xotcl-request-monitor/www/last100.tcl 25 Jan 2020 14:17:59 -0000 1.12.2.2 +++ openacs-4/packages/xotcl-request-monitor/www/last100.tcl 6 Apr 2020 17:16:59 -0000 1.12.2.3 @@ -39,12 +39,10 @@ foreach l $stat { lassign $l timestamp c url ms requestor - if {[string is integer $requestor]} { - set user_string [person::name -person_id $requestor] - } else { - set user_string $requestor - } + set user_info [xo::request_monitor_user_info $requestor] + set user_string [dict get $user_info label] + # # Provide the URLs only to admins as links. # Index: openacs-4/packages/xotcl-request-monitor/www/last101.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-request-monitor/www/last101.tcl,v diff -u -r1.9.2.3 -r1.9.2.4 --- openacs-4/packages/xotcl-request-monitor/www/last101.tcl 31 Jan 2020 17:59:51 -0000 1.9.2.3 +++ openacs-4/packages/xotcl-request-monitor/www/last101.tcl 6 Apr 2020 17:16:59 -0000 1.9.2.4 @@ -37,11 +37,9 @@ foreach l $stat { lassign $l timestamp c url ms requestor - if {[string is integer $requestor]} { - set user_string [person::name -person_id $requestor] - } else { - set user_string $requestor - } + set user_info [xo::request_monitor_user_info $requestor] + set user_string [dict get $user_info label] + t1 add -time [clock format $timestamp -format "%H:%M:%S"] \ -user $user_string \ -user.href [export_vars -base last-requests {{request_key $requestor}}] \ Index: openacs-4/packages/xotcl-request-monitor/www/long-calls.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-request-monitor/www/long-calls.tcl,v diff -u -r1.4.2.2 -r1.4.2.3 --- openacs-4/packages/xotcl-request-monitor/www/long-calls.tcl 27 Mar 2019 18:10:10 -0000 1.4.2.2 +++ openacs-4/packages/xotcl-request-monitor/www/long-calls.tcl 6 Apr 2020 17:16:59 -0000 1.4.2.3 @@ -16,8 +16,9 @@ if {![string is integer -strict $uid]} { set userinfo 0 } else { - set user_url [acs_community_member_admin_url -user_id $uid] - set userinfo "$uid" + set user_info [xo::request_monitor_user_info $uid] + set user_url [dict get $user_info url] + set userinfo "$uid" } return $userinfo } Index: openacs-4/packages/xotcl-request-monitor/www/running.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-request-monitor/www/running.tcl,v diff -u -r1.10.2.3 -r1.10.2.4 --- openacs-4/packages/xotcl-request-monitor/www/running.tcl 1 Nov 2019 13:20:13 -0000 1.10.2.3 +++ openacs-4/packages/xotcl-request-monitor/www/running.tcl 6 Apr 2020 17:16:59 -0000 1.10.2.4 @@ -46,29 +46,23 @@ Field background -label "Background" Field progress -label "Progress" } \ - -no_data "Currently no running requests" + -no_data "Currently no running requests" set sortable_requests [list] foreach {key elapsed} $running_requests { lassign [split $key ,] requestor url set ms [format %.2f [expr {[throttle ms -start_time $elapsed]/1000.0}]] - if {[string is integer $requestor]} { - set user_string [person::name -person_id $requestor] - } else { - set user_string $requestor - } + set user_info [xo::request_monitor_user_info $requestor] + set user_string [dict get $user_info label] set user_url "last-requests?request_key=$requestor" lappend sortable_requests [list $user_string $user_url $url $ms ""] } foreach {index entry} $background_requests { lassign $entry key elapsed lassign [split $key ,] requestor url set ms [format %.2f [expr {[throttle ms -start_time $elapsed]/-1000.0}]] - if {[string is integer $requestor]} { - set user_string [person::name -person_id $requestor] - } else { - set user_string $requestor - } + set user_info [xo::request_monitor_user_info $requestor] + set user_string [dict get $user_info label] set user_url "last-requests?request_key=$requestor" lappend sortable_requests [list $user_string $user_url $url $ms "::bgdelivery"] } @@ -96,7 +90,7 @@ set progress [format {%5.2f%% of %5.2f MB} $percentage [expr {$size/1000000.0}]] set ms [format %.2f [expr {([clock milliseconds] - $starttime*1000)/-1000.0}]] if {[string is integer $requestor]} { - set user_string [person::name -person_id $requestor] + set user_string [person::name -person_id $requestor] } else { set user_string $requestor } Index: openacs-4/packages/xotcl-request-monitor/www/throttle-statistics.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-request-monitor/www/throttle-statistics.tcl,v diff -u -r1.5.2.1 -r1.5.2.2 --- openacs-4/packages/xotcl-request-monitor/www/throttle-statistics.tcl 25 Jan 2020 14:17:59 -0000 1.5.2.1 +++ openacs-4/packages/xotcl-request-monitor/www/throttle-statistics.tcl 6 Apr 2020 17:16:59 -0000 1.5.2.2 @@ -34,8 +34,9 @@ set user "Anonymous" set user_url "" } else { - set user [person::name -person_id $uid] - set user_url [acs_community_member_admin_url -user_id $uid] + set user_info [xo::request_monitor_user_info $uid] + set user [dict get $user_info label] + set user_url [dict get $user_info url] } set time [clock format $time -format "%Y-%m-%d %H:%M:%S"] multirow append url_statistics $type $user $user_url $time $IPaddress $URL Index: openacs-4/packages/xotcl-request-monitor/www/users-in-community.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-request-monitor/www/users-in-community.tcl,v diff -u -r1.8.2.1 -r1.8.2.2 --- openacs-4/packages/xotcl-request-monitor/www/users-in-community.tcl 25 Jan 2020 14:17:59 -0000 1.8.2.1 +++ openacs-4/packages/xotcl-request-monitor/www/users-in-community.tcl 6 Apr 2020 17:16:59 -0000 1.8.2.2 @@ -27,13 +27,9 @@ lassign $e timestamp requestor if {[info exists listed($requestor)]} continue set listed($requestor) 1 - if {[string is integer -strict $requestor]} { - set user_string [person::name -person_id $requestor] - } else { - set user_string $requestor - } + set user_info [xo::request_monitor_user_info $requestor] set time [clock format $timestamp -format "%H:%M"] - t1 add -time $time -user $user_string + t1 add -time $time -user [dict get $user_info label] } set t1 [t1 asHTML] Index: openacs-4/packages/xotcl-request-monitor/www/whos-online-today.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-request-monitor/www/whos-online-today.tcl,v diff -u -r1.9.2.4 -r1.9.2.5 --- openacs-4/packages/xotcl-request-monitor/www/whos-online-today.tcl 25 Jan 2020 14:13:46 -0000 1.9.2.4 +++ openacs-4/packages/xotcl-request-monitor/www/whos-online-today.tcl 6 Apr 2020 17:16:59 -0000 1.9.2.5 @@ -46,18 +46,9 @@ foreach element $elements { lassign $element user_id timestamp - if {[string is integer $user_id]} { - set person [person::get_person_info -person_id $user_id] - set user_label "[dict get $person last_name], [dict get $person first_names]" - set user_url [acs_community_member_url -user_id $user_id] - } else { - # it was an IP address - set user_label $user_id - set user_url "" - } - - lappend users [list $user_label \ - $user_url \ + set user_info [xo::request_monitor_user_info $user_id] + lappend users [list [dict get $user_info label] \ + [dict get $user_info url] \ $timestamp \ [::xowiki::utility pretty_age \ -timestamp [clock scan [lc_clock_to_ansi $timestamp]]] \ Index: openacs-4/packages/xotcl-request-monitor/www/whos-online.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-request-monitor/www/whos-online.tcl,v diff -u -r1.16.2.1 -r1.16.2.2 --- openacs-4/packages/xotcl-request-monitor/www/whos-online.tcl 25 Jan 2020 14:17:59 -0000 1.16.2.1 +++ openacs-4/packages/xotcl-request-monitor/www/whos-online.tcl 6 Apr 2020 17:16:59 -0000 1.16.2.2 @@ -63,15 +63,13 @@ set users [list] foreach element [throttle users active -full] { lassign $element user_id pa timestamp hits smooth switches - if {[string is integer $user_id]} { - set person [person::get_person_info -person_id $user_id] - set user_label "[dict get $person last_name], [dict get $person first_names]" - set user_url [acs_community_member_url -user_id $user_id] - } else { - if {$all} continue + + set user_info [xo::request_monitor_user_info $user_id] + set user_label [dict get $user_info label] + set user_url [dict get $user_info url] + if {![string is integer $user_id] && !$all} { # it was an IP address - set user_label $user_id - set user_url "" + continue } set timestamp [lindex $smooth 2] set last_request_minutes [expr {[clock seconds]/60 - $timestamp}]