Index: openacs.org-dev/packages/acs-tcl/tcl/apm-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs.org-dev/packages/acs-tcl/tcl/apm-procs.tcl,v diff -u -N -r1.1.1.1 -r1.1.1.2 --- openacs.org-dev/packages/acs-tcl/tcl/apm-procs.tcl 9 Jul 2002 17:34:59 -0000 1.1.1.1 +++ openacs.org-dev/packages/acs-tcl/tcl/apm-procs.tcl 8 Oct 2002 15:46:50 -0000 1.1.1.2 @@ -331,7 +331,7 @@ set files [ad_find_all_files [acs_root_dir]/packages/$package] if { [llength $files] == 0 } { - error "Unable to locate [acs_root_dir]/packages/$package/*." + ns_log Error "apm_load_queries: Unable to locate [acs_root_dir]/packages/$package/*. when scanning for SQL queries to load." } foreach file [lsort $files] { @@ -742,6 +742,10 @@ } } +# +# package_id -> package_key +# + ad_proc -public apm_package_key_from_id {package_id} { @return The package key of the instance. } { @@ -754,6 +758,10 @@ } -default ""] } +# +# package_key -> package_id +# + ad_proc -public apm_package_id_from_key {package_key} { @return The package id of the instance of the package. 0 if no instance exists, error if several instances exist. @@ -767,22 +775,41 @@ } -default 0] } -ad_proc -public apm_package_url_from_key {package_key} { +# +# package_id -> package_url +# + +ad_proc -public apm_package_url_from_id {package_id} { @return The package url of the instance of the package. only valid for singleton packages. } { - return [util_memoize "apm_package_url_from_key_mem $package_key"] + return [util_memoize "apm_package_url_from_id_mem $package_id"] } -ad_proc -public apm_package_url_from_key_mem {package_key} { - set package_id [apm_package_id_from_key $package_key] - return [db_string apm_package_url_from_key { +ad_proc -public apm_package_url_from_id_mem {package_id} { + return [db_string apm_package_url_from_id { select site_node.url(node_id) from site_nodes where object_id = :package_id } -default ""] } +# +# package_key -> package_url +# + +ad_proc -public apm_package_url_from_key {package_key} { + @return The package url of the instance of the package. + only valid for singleton packages. +} { + return [util_memoize "apm_package_url_from_key_mem $package_key"] +} + +ad_proc -public apm_package_url_from_key_mem {package_key} { + set package_id [apm_package_id_from_key $package_key] + return [apm_package_url_from_id $package_id] +} + ad_proc -public apm_version_info {version_id} { Sets a set of common package information in the caller's environment. @@ -946,3 +973,18 @@ db_exec_plsql apm_package_instance_delete {} } +## +## Logging +## + +ad_proc -public apm_log { + level + msg +} { + Centralized APM logging. If you want to debug the APM, change + APMDebug to Debug and restart the server. +} { + if {![string equal "APMDebug" $level]} { + ns_log $level "$msg" + } +}