Index: openacs-4/packages/acs-tcl/tcl/00-icanuse-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/00-icanuse-procs.tcl,v diff -u -r1.1.2.31 -r1.1.2.32 --- openacs-4/packages/acs-tcl/tcl/00-icanuse-procs.tcl 5 Dec 2021 15:42:02 -0000 1.1.2.31 +++ openacs-4/packages/acs-tcl/tcl/00-icanuse-procs.tcl 5 Jan 2022 14:00:20 -0000 1.1.2.32 @@ -256,6 +256,34 @@ } } +if {[info commands ::ns_baseunit] eq ""} { + + ad_proc ns_baseunit {-size -time} { + + Partial backward compatibility function of + "ns_baseunit ?-size size? ?-time time?" + Only the time unit part is partially implemented, + therefore, icanuse is not set for that feature. + + } { + if {[info exists size]} { + error "partial implementation of ns_baseunit does not support -size option" + } + if {![string is integer -strict $time]} { + if {[regexp {^(\d+)d$} $time _ t]} { + set time [expr {60*60*24*$t}] + } elseif {[regexp {^(\d+)h$} $time _ t]} { + set time [expr {60*60*$t}] + } elseif {[regexp {^(\d+)m$} $time _ t]} { + set time [expr {60*$t}] + } else { + error "rp_serve_resource_file: invalid time '$time' specified" + } + } + return $time + } +} + # Local variables: # mode: tcl # tcl-indent-level: 4 Index: openacs-4/packages/acs-tcl/tcl/request-processor-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/request-processor-procs.tcl,v diff -u -r1.153.2.45 -r1.153.2.46 --- openacs-4/packages/acs-tcl/tcl/request-processor-procs.tcl 5 Jan 2022 13:10:52 -0000 1.153.2.45 +++ openacs-4/packages/acs-tcl/tcl/request-processor-procs.tcl 5 Jan 2022 14:00:20 -0000 1.153.2.46 @@ -454,17 +454,12 @@ } set expireTime [parameter::get -package_id $::acs::kernel_id -parameter ResourcesExpireInterval -default 0] if {$expireTime != 0} { - if {![string is integer -strict $expireTime]} { - if {[regexp {^(\d+)d} $expireTime _ t]} { - set expireTime [expr {60*60*24*$t}] - } elseif {[regexp {^(\d+)h} $expireTime _ t]} { - set expireTime [expr {60*60*$t}] - } elseif {[regexp {^(\d+)m} $expireTime _ t]} { - set expireTime [expr {60*$t}] - } else { - ns_log error "rp_serve_resource_file: invalid expire time '$expireTime' specified" - set expireTime 0 - } + try { + expr {int([ns_baseunit -time $expireTime])} + } on ok {expireTime} { + } on error {errorMsg} { + ns_log error "rp_serve_resource_file: invalid expire time '$expireTime' specified" + set expireTime 0 } ns_setexpires $expireTime }