Index: openacs-4/packages/file-storage/tcl/file-storage-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/file-storage-procs.tcl,v diff -u -N -r1.90.2.32 -r1.90.2.33 --- openacs-4/packages/file-storage/tcl/file-storage-procs.tcl 16 Mar 2023 14:58:57 -0000 1.90.2.32 +++ openacs-4/packages/file-storage/tcl/file-storage-procs.tcl 17 Mar 2023 13:25:07 -0000 1.90.2.33 @@ -703,6 +703,10 @@ return the archive command after replacing {in_file} and {out_file} with their respective values. } { + if {[ad_conn package_key] ne "file-storage"} { + error "fs::get_archive_command must be called inside the file-storage" + } + set cmd [parameter::get -parameter ArchiveCommand -default "tar cf - {in_file} | gzip > {out_file}"] regsub -all -- {(\W)} $in_file {\\\1} in_file Index: openacs-4/packages/file-storage/tcl/test/file-storage-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/test/file-storage-procs.tcl,v diff -u -N -r1.10.2.23 -r1.10.2.24 --- openacs-4/packages/file-storage/tcl/test/file-storage-procs.tcl 16 Mar 2023 14:49:11 -0000 1.10.2.23 +++ openacs-4/packages/file-storage/tcl/test/file-storage-procs.tcl 17 Mar 2023 13:25:07 -0000 1.10.2.24 @@ -63,14 +63,26 @@ Test api concerning archiving } { - set wfd [ad_opentmpfile in_file .in] - set out_file [file rootname $in_file].out + set orig_package_key [ad_conn package_key] + set orig_package_id [ad_conn package_id] try { + set wfd [ad_opentmpfile in_file .in] + set out_file [file rootname $in_file].out + puts $wfd abcd close $wfd set in_file_hash [ns_md file $in_file] + # + # We simulate a file-storage connection context + # + ad_conn -set package_key "file-storage" + ad_conn -set package_id [db_string get_fs_is { + select max(package_id) from apm_packages + where package_key = 'file-storage' + }] + exec -ignorestderr {*}[fs::get_archive_command \ -in_file $in_file \ -out_file $out_file] @@ -81,6 +93,8 @@ aa_true "Archive '$out_file' was generated" \ [file exists $out_file] } finally { + ad_conn -set package_key $orig_package_key + ad_conn -set package_id $orig_package_id file delete -- $in_file $out_file } }