Index: openacs-4/packages/acs-content-repository/acs-content-repository.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/acs-content-repository.info,v
diff -u -r1.117.2.7 -r1.117.2.8
--- openacs-4/packages/acs-content-repository/acs-content-repository.info 24 Mar 2021 10:09:58 -0000 1.117.2.7
+++ openacs-4/packages/acs-content-repository/acs-content-repository.info 6 Apr 2021 19:16:16 -0000 1.117.2.8
@@ -7,21 +7,24 @@
t
t
-
+
f
t
OpenACS
The canonical repository for OpenACS content.
2017-08-06
OpenACS
- Provides the API for creating and managing user generated content including
- full support for versioning, rendering content to the filesystem, folders and composite content items, and
- other CMS backing functionality. Utilized by Bug Tracker, File Storage, and other packages.
+
+ Provides the API for creating and managing user generated
+ content including full support for versioning, rendering
+ content to the filesystem, folders and composite content
+ items, and other CMS backing functionality. Utilized by
+ Bug Tracker, File Storage, and other packages.
GPL
3
-
+
Index: openacs-4/packages/acs-content-repository/tcl/content-revision-procs-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/content-revision-procs-oracle.xql,v
diff -u -r1.9.2.1 -r1.9.2.2
--- openacs-4/packages/acs-content-repository/tcl/content-revision-procs-oracle.xql 22 Feb 2021 11:47:19 -0000 1.9.2.1
+++ openacs-4/packages/acs-content-repository/tcl/content-revision-procs-oracle.xql 6 Apr 2021 19:16:16 -0000 1.9.2.2
@@ -64,12 +64,19 @@
select storage_area_key,
filename
- from cr_items ci,
- cr_revisions cr
+ from cr_items ci, cr_revisions cr
where cr.item_id=ci.item_id
and cr.revision_id=:revision_id
+
+
+
+ select content
+ from cr_revisions
+ where revision_id = :revision_id
+
+
Index: openacs-4/packages/acs-content-repository/tcl/content-revision-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/content-revision-procs-postgresql.xql,v
diff -u -r1.7.2.1 -r1.7.2.2
--- openacs-4/packages/acs-content-repository/tcl/content-revision-procs-postgresql.xql 22 Feb 2021 11:47:19 -0000 1.7.2.1
+++ openacs-4/packages/acs-content-repository/tcl/content-revision-procs-postgresql.xql 6 Apr 2021 19:16:16 -0000 1.7.2.2
@@ -51,4 +51,12 @@
and cr.revision_id=:revision_id
+
+
+
+ select lob
+ from cr_revisions
+ where revision_id = :revision_id
+
+
Index: openacs-4/packages/acs-content-repository/tcl/content-revision-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/content-revision-procs.tcl,v
diff -u -r1.36.2.3 -r1.36.2.4
--- openacs-4/packages/acs-content-repository/tcl/content-revision-procs.tcl 22 Feb 2021 11:47:19 -0000 1.36.2.3
+++ openacs-4/packages/acs-content-repository/tcl/content-revision-procs.tcl 6 Apr 2021 19:16:16 -0000 1.36.2.4
@@ -818,7 +818,76 @@
return [cr_fs_path $storage_area_key]${filename}
}
+#
+# ::content::revision::export_to_filesystem
+#
+# This function was previously part of
+# fs::publish_versioned_object_to_file_system but the application
+# packages should be fully agnostic to the storage_type
+# implementation.
+ad_proc ::content::revision::export_to_filesystem {
+ -revision_id:required
+ -storage_type:required
+ -filename:required
+} {
+ Export the content of the provided revision to the named file in
+ the file system.
+} {
+ ::content::revision::write_to_filesystem-$storage_type \
+ -revision_id $revision_id \
+ -filename $filename
+}
+
+ad_proc -private ::content::revision::export_to_filesystem-text {
+ -revision_id:required
+ -filename:required
+} {
+ Export the content of the provided revision to the named file in
+ the file system.
+} {
+ set content [db_string select_object_content {
+ select content from cr_revisions where revision_id = :live_revision
+ }]
+ set fp [open $filename w]
+ puts $fp $content
+ close $fp
+}
+
+ad_proc -private ::content::revision::export_to_filesystem-file {
+ -revision_id:required
+ -filename:required
+} {
+ Export the content of the provided revision to the named file in
+ the file system.
+} {
+ set cr_file_name [content::revision::get_cr_file_path -revision_id $live_revision]
+
+ #
+ # When there are multiple "unnamed files" in a directory, the
+ # constructed filename might exist already. This would lead to an
+ # error in the "file copy" operation. Therefore, generate a new
+ # name with an alternate suffix in these cases.
+ #
+ set base_name $filename
+ set count 0
+ while {[ad_file exists $filename]} {
+ set filename $base_name-[incr $count]
+ }
+
+ file copy -- $cr_file_name $filename
+}
+
+ad_proc -private ::content::revision::export_to_filesystem-lob {
+ -revision_id:required
+ -filename:required
+} {
+ Export the content of the provided revision to the named file in
+ the file system.
+} {
+ db_blob_get_file select_object_content {} -file $filename
+}
+
# Local variables:
# mode: tcl
# tcl-indent-level: 4
Index: openacs-4/packages/file-storage/file-storage.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/file-storage.info,v
diff -u -r1.60.2.10 -r1.60.2.11
--- openacs-4/packages/file-storage/file-storage.info 9 Mar 2021 09:40:29 -0000 1.60.2.10
+++ openacs-4/packages/file-storage/file-storage.info 6 Apr 2021 19:16:16 -0000 1.60.2.11
@@ -7,7 +7,7 @@
f
f
-
+
OpenACS
Collaborative document storage
2017-08-06
@@ -17,10 +17,10 @@
2
#file-storage.file-storage#
-
+
-
+
Index: openacs-4/packages/file-storage/tcl/file-storage-procs-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/file-storage-procs-oracle.xql,v
diff -u -r1.39.2.3 -r1.39.2.4
--- openacs-4/packages/file-storage/tcl/file-storage-procs-oracle.xql 23 Oct 2020 17:03:05 -0000 1.39.2.3
+++ openacs-4/packages/file-storage/tcl/file-storage-procs-oracle.xql 6 Apr 2021 19:16:16 -0000 1.39.2.4
@@ -71,22 +71,6 @@
-
-
- select content
- from cr_revisions
- where revision_id = :live_revision
-
-
-
-
-
- select filename
- from cr_revisions
- where revision_id = :live_revision
-
-
-
begin
Index: openacs-4/packages/file-storage/tcl/file-storage-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/file-storage-procs-postgresql.xql,v
diff -u -r1.51.2.3 -r1.51.2.4
--- openacs-4/packages/file-storage/tcl/file-storage-procs-postgresql.xql 23 Oct 2020 17:03:05 -0000 1.51.2.3
+++ openacs-4/packages/file-storage/tcl/file-storage-procs-postgresql.xql 6 Apr 2021 19:16:16 -0000 1.51.2.4
@@ -59,22 +59,6 @@
-
-
- select lob
- from cr_revisions
- where revision_id = :live_revision
-
-
-
-
-
- select content
- from cr_revisions
- where revision_id = :live_revision
-
-
-
select file_storage__new_file (
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 -r1.90.2.15 -r1.90.2.16
--- openacs-4/packages/file-storage/tcl/file-storage-procs.tcl 6 Apr 2021 18:25:42 -0000 1.90.2.15
+++ openacs-4/packages/file-storage/tcl/file-storage-procs.tcl 6 Apr 2021 19:16:16 -0000 1.90.2.16
@@ -683,48 +683,13 @@
-tolower \
$file_name]
- switch -- $storage_type {
- lob {
-
- # FIXME: db_blob_get_file is failing when i use bind variables
-
- # DRB: you're out of luck - the driver doesn't support them and while it should
- # be fixed it will be a long time before we'll want to require an updated
- # driver. I'm substituting the Tcl variable value directly in the query due to
- # this. It's safe because we've pulled the value ourselves from the database,
- # don't need to worry about SQL smuggling etc.
-
- db_blob_get_file select_object_content {} -file [ad_file join $path $file_name]
- }
- text {
- set content [db_string select_object_content {}]
-
- set fp [open [ad_file join $path $file_name] w]
- puts $fp $content
- close $fp
- }
- file {
- set cr_file_name [content::revision::get_cr_file_path -revision_id $live_revision]
-
- #
- # When there are multiple "unnamed files" in a directory,
- # the constructed full_name might exist already. This
- # would lead to an error in the "file copy"
- # operation. Therefore, generate a new name with an
- # alternate suffix in these cases.
- #
- set full_name [ad_file join $path $file_name]
- set base_name $full_name
- set count 0
- while {[ad_file exists $full_name]} {
- set full_name $base_name-[incr $count]
- }
-
- file copy -- $cr_file_name $full_name
- }
- }
-
- return [ad_file join $path $file_name]
+ set full_filename [ad_file join $path $file_name]
+ ::content::revision::write_to_filesystem \
+ -storage_type $storage_type \
+ -revision_id $live_revision \
+ -filename $full_filename
+
+ return $full_filename
}
ad_proc -public fs::get_archive_command {