Index: openacs-4/packages/acs-tcl/tcl/00-icanuse-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/Attic/00-icanuse-procs.tcl,v diff -u -r1.1.2.30 -r1.1.2.31 --- openacs-4/packages/acs-tcl/tcl/00-icanuse-procs.tcl 29 Oct 2021 10:35:59 -0000 1.1.2.30 +++ openacs-4/packages/acs-tcl/tcl/00-icanuse-procs.tcl 5 Dec 2021 15:42:02 -0000 1.1.2.31 @@ -110,6 +110,7 @@ ::acs::register_icanuse "ns_setcookie -samesite" [acs::cmd_error_contains ns_setcookie -samesite] ::acs::register_icanuse "ns_urlencode -part oauth1" [acs::cmd_error_contains {ns_urlencode -part xxx} oauth1] ::acs::register_icanuse "ns_writer" {[info commands ::ns_writer] ne ""} +::acs::register_icanuse "ns_baseunit" {[info commands ::ns_baseunit] ne ""} # # At the time "ns_trim -prefix was introduced, a memory leak in Index: openacs-4/packages/acs-tcl/tcl/acs-cache-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/acs-cache-procs.tcl,v diff -u -r1.10.2.21 -r1.10.2.22 --- openacs-4/packages/acs-tcl/tcl/acs-cache-procs.tcl 18 Nov 2021 19:56:14 -0000 1.10.2.21 +++ openacs-4/packages/acs-tcl/tcl/acs-cache-procs.tcl 5 Dec 2021 15:42:02 -0000 1.10.2.22 @@ -51,10 +51,28 @@ # Determine the cache size depending on configuration # variables. # - return [::parameter::get_from_package_key \ - -package_key ${:package_key} \ - -parameter "${:parameter}Size" \ - -default ${:default_size}] + set specifiedSize [::parameter::get_from_package_key \ + -package_key ${:package_key} \ + -parameter "${:parameter}Size" \ + -default ${:default_size}] + if {[::nsf::is integer $specifiedSize]} { + set size $specifiedSize + } else { + if {[acs::icanuse ns_baseunit]} { + set size [ns_baseunit -size $specifiedSize] + } else { + # + # Rough approximation for older versions of NaviServer. + # + if {[regexp {^(\d+)([mk])b} [string tolower $specifiedSize] . amount unit]} { + set multipliers {k 1024 m 1048576} + set size [expr {[dict get $multipliers $unit] * $amount}] + } else { + error "invalid size specification '$specifiedSize'" + } + } + } + return $size } :public method flush {{-partition_key} key} { @@ -687,7 +705,7 @@ } namespace eval ::acs { - ad_proc -private try_cache {cache key cmd} { + ad_proc -private try_cache {cache operation key args} { Function to support caching during bootstrap. When the provided cache exists, then use it for caching, otherwise @@ -698,10 +716,13 @@ } { if {[info commands $cache] ne ""} { - return [uplevel [list $cache eval $key $cmd]] + return [uplevel [list $cache $operation $key {*}$args]] } else { - ns_log warning "no cache $cache: need direct call $key $cmd" - return [uplevel $cmd] + if {$operation eq "eval"} { + ns_log warning "no cache $cache: need direct call $key $args" + return [uplevel {*}$args] + } + ns_log warning "no cache $cache: call ignored" } } } Index: openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl,v diff -u -r1.126.2.19 -r1.126.2.20 --- openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl 18 Nov 2021 19:13:46 -0000 1.126.2.19 +++ openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl 5 Dec 2021 15:42:02 -0000 1.126.2.20 @@ -1026,8 +1026,10 @@ -arg_list [list from_version_name $upgrade_from_version_name to_version_name $version(name)] } - # Flush the installed_p cache - acs::misc_cache flush apm_package_installed-$package_key + if {[info commands ::acs::misc_cache] ne ""} { + # Flush the installed_p cache + acs::misc_cache flush apm_package_installed-$package_key + } return $version_id } @@ -1541,7 +1543,8 @@ @param version_id The id of the version to be enabled. } { db_exec_plsql apm_package_version_enable {} - acs::misc_cache flush apm_package_enabled-[apm_package_key_from_version_id $version_id] + acs::try_cache acs::misc_cache flush \ + apm_package_enabled-[apm_package_key_from_version_id $version_id] apm_callback_and_log $callback "

Package enabled." } @@ -1552,7 +1555,8 @@ @param version_id The id of the version to be disabled. } { db_exec_plsql apm_package_version_disable {} - acs::misc_cache flush apm_package_enabled-[apm_package_key_from_version_id $version_id] + acs::try_cache acs::misc_cache flush \ + apm_package_enabled-[apm_package_key_from_version_id $version_id] apm_callback_and_log $callback "

Package disabled." } Index: openacs-4/packages/acs-tcl/tcl/apm-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/apm-procs.tcl,v diff -u -r1.114.2.36 -r1.114.2.37 --- openacs-4/packages/acs-tcl/tcl/apm-procs.tcl 18 Nov 2021 19:56:15 -0000 1.114.2.36 +++ openacs-4/packages/acs-tcl/tcl/apm-procs.tcl 5 Dec 2021 15:42:03 -0000 1.114.2.37 @@ -1022,7 +1022,7 @@ Returns 1 if there is an installed package version corresponding to the package_key, 0 otherwise. Uses a cached value for performance. } { - acs::try_cache ::acs::misc_cache apm_package_installed-$package_key { + acs::try_cache ::acs::misc_cache eval apm_package_installed-$package_key { db_0or1row apm_package_installed_p { select 1 from apm_package_versions where package_key = :package_key @@ -1037,7 +1037,7 @@ Returns 1 if there is an enabled package version corresponding to the package_key and 0 otherwise. } { - acs::try_cache ::acs::misc_cache apm_package_enabled-$package_key { + acs::try_cache ::acs::misc_cache eval apm_package_enabled-$package_key { db_0or1row apm_package_enabled_p { select 1 from apm_package_versions where package_key = :package_key