Index: openacs-4/packages/acs-tcl/acs-tcl.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/acs-tcl.info,v
diff -u -N -r1.95.2.1 -r1.95.2.2
--- openacs-4/packages/acs-tcl/acs-tcl.info 15 Feb 2019 11:03:57 -0000 1.95.2.1
+++ openacs-4/packages/acs-tcl/acs-tcl.info 5 Jun 2019 10:26:31 -0000 1.95.2.2
@@ -9,7 +9,7 @@
f
t
-
+
OpenACS
The Kernel Tcl API library.
2017-08-06
@@ -18,7 +18,7 @@
GPL version 2
3
-
+
Index: openacs-4/packages/acs-tcl/tcl/00-canisue-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/Attic/00-canisue-procs.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-tcl/tcl/00-canisue-procs.tcl 5 Jun 2019 10:26:31 -0000 1.1.2.1
@@ -0,0 +1,72 @@
+ad_library {
+
+ An API for checking optional features (name inspired by caniuse.com)
+
+ @creation-date 4th June 2019
+ @author Gustaf Neumann
+}
+
+namespace eval ::acs {
+ ad_proc -public icanuse {feature} {
+
+ Check, if a (previously registered) feature can be used in an
+ installation. These features are typically version dependent
+ features of NaviServer. The checking of the availability of
+ these feratures is typically more complex than a plain "info
+ commands ...".
+
+ @param feature name for a feature, can contain blanks
+ @return boolean value
+
+ } {
+ return [info exists ::acs::caniuse($feature)]
+ }
+
+ ad_proc -public register_icanuse {feature condition} {
+
+ Registry function for acs::caniuse.
+
+ @param feature name for a feature, can contain blanks
+ @param condition expression to determine availability
+ } {
+ set success 0
+ try {
+ expr $condition
+ } on ok {result} {
+ set success $result
+ } on error {errorMsg} {
+ # just use the default
+ ns_log warning "registry for caniuse $feature -> $errorMsg"
+ }
+ if {$success} {
+ set ::acs::caniuse($feature) 1
+ }
+ ns_log notice "... I can use $feature -> $success"
+ }
+
+ ad_proc -private cmd_has_subcommand {cmd subcommand} {
+
+ Helper proc abusing error messages to determine, whether as
+ submethod is available.
+
+ } {
+ catch [list $cmd ""] errorMsg
+ return [expr {" $subcommand" in [split $errorMsg ","]}]
+ }
+}
+# Notice: can use 'ns_db currenthandles'
+
+::acs::register_icanuse "ns_db currenthandles" [acs::cmd_has_subcommand ns_db currenthandles]
+::acs::register_icanuse "ns_server ummap" [acs::cmd_has_subcommand ns_server unmap]
+#
+# "ns_server ummap" was introduced in NaviServer at the same time as
+# "ns_conn partialtimes" but the latter would requires a connection
+# (which is not available during loading).
+#
+::acs::register_icanuse "ns_conn partialtimes" [acs::icanuse "ns_server ummap"]
+
+# Local variables:
+# mode: tcl
+# tcl-indent-level: 4
+# indent-tabs-mode: nil
+# End:
Index: openacs-4/packages/acs-tcl/tcl/00-database-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/00-database-procs.tcl,v
diff -u -N -r1.126.2.4 -r1.126.2.5
--- openacs-4/packages/acs-tcl/tcl/00-database-procs.tcl 28 Mar 2019 21:11:22 -0000 1.126.2.4
+++ openacs-4/packages/acs-tcl/tcl/00-database-procs.tcl 5 Jun 2019 10:26:31 -0000 1.126.2.5
@@ -525,20 +525,10 @@
return $pool
}
+if {[acs::icanuse "ns_db currenthandles"]} {
-set useNsdbCurrentHandles 0
-try {
- ns_db x
-} on error {errorMsg} {
- if {"currenthandles," in [split $errorMsg " "]} {
- ns_log notice "can use 'ns_db currenthandles'"
- set useNsdbCurrentHandles 1
- } else {
- ns_log notice "cannot use 'ns_db currenthandles'"
- }
-}
+ ns_log notice "... I can use 'ns_db currenthandles'"
-if {$useNsdbCurrentHandles} {
#
# This branch uses "ns_db currenthandles" to implement
# "db_with_handle" instead of the old approach based on the global
@@ -738,6 +728,7 @@
# This is the legacy branch without [ns_db currenthandles], using
# the global state variables.
#
+ ns_log notice "... cannot use 'ns_db currenthandles'"
ad_proc -public db_with_handle {
{ -dbn "" }