Index: openacs-4/packages/acs-content-repository/tcl/revision-procs-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/revision-procs-oracle.xql,v
diff -u -r1.13 -r1.13.20.1
--- openacs-4/packages/acs-content-repository/tcl/revision-procs-oracle.xql 22 Apr 2005 08:29:49 -0000 1.13
+++ openacs-4/packages/acs-content-repository/tcl/revision-procs-oracle.xql 3 Jan 2020 10:43:36 -0000 1.13.20.1
@@ -2,16 +2,6 @@
oracle8.1.6
-
-
- select r.mime_type, i.storage_type, i.storage_area_key,
- r.revision_id, r.content_length
- from cr_revisions r, cr_items i
- where i.item_id = r.item_id and
- r.revision_id = content_item.get_live_revision(:item_id)
-
-
-
select :path || filename
@@ -28,27 +18,6 @@
-
-
-
- begin
- content_type.register_mime_type('content_revision', :mime_type);
- end;
-
-
-
-
-
- select content_item.is_subclass(:image_type, 'image') from dual
-
-
-
-
-
- select content_item.is_subclass(:other_type, 'content_revision') from dual
-
-
-
begin
@@ -154,15 +123,5 @@
end;
-
-
-
- update cr_revisions
- set filename = :filename,
- mime_type = :mime_type,
- content_length = :tmp_size
- where revision_id = :revision_id
-
-
Index: openacs-4/packages/acs-content-repository/tcl/revision-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/revision-procs-postgresql.xql,v
diff -u -r1.11.2.1 -r1.11.2.2
--- openacs-4/packages/acs-content-repository/tcl/revision-procs-postgresql.xql 9 Oct 2019 15:22:59 -0000 1.11.2.1
+++ openacs-4/packages/acs-content-repository/tcl/revision-procs-postgresql.xql 3 Jan 2020 10:43:37 -0000 1.11.2.2
@@ -2,15 +2,6 @@
postgresql7.1
-
-
- select i.storage_type, i.storage_area_key, r.mime_type,
- r.revision_id, r.content_length
- from cr_items i, cr_revisions r
- where r.revision_id = content_item__get_live_revision(:item_id) and i.item_id = r.item_id
-
-
-
select :path || content
@@ -27,24 +18,6 @@
-
-
- select content_type__register_mime_type('content_revision', :mime_type)
-
-
-
-
-
- select content_item__is_subclass(:image_type, 'image')
-
-
-
-
-
- select content_item__is_subclass(:other_type, 'content_revision')
-
-
-
select image__new(
@@ -162,14 +135,4 @@
-
-
- update cr_revisions
- set content = :filename,
- mime_type = :mime_type,
- content_length = :tmp_size
- where revision_id = :revision_id
-
-
-
Index: openacs-4/packages/acs-content-repository/tcl/revision-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/revision-procs.tcl,v
diff -u -r1.37.2.1 -r1.37.2.2
--- openacs-4/packages/acs-content-repository/tcl/revision-procs.tcl 16 Dec 2019 17:14:38 -0000 1.37.2.1
+++ openacs-4/packages/acs-content-repository/tcl/revision-procs.tcl 3 Jan 2020 10:43:37 -0000 1.37.2.2
@@ -34,11 +34,28 @@
}
if { [info exists item_id] } {
- if { ![db_0or1row get_item_info ""] } {
+ if { ![db_0or1row get_item_info {
+ select i.storage_type,
+ i.storage_area_key,
+ r.mime_type,
+ r.revision_id,
+ r.content_length
+ from cr_items i, cr_revisions r
+ where i.item_id = :item_id
+ and r.revision_id = i.live_revision
+ }] } {
error "There is no content that matches item_id '$item_id'" {} NOT_FOUND
}
} elseif { [info exists revision_id] } {
- if { ![db_0or1row get_revision_info ""] } {
+ if { ![db_0or1row get_revision_info {
+ select i.storage_type,
+ i.storage_area_key,
+ r.mime_type,
+ i.item_id,
+ r.content_length
+ from cr_items i, cr_revisions r
+ where r.revision_id = :revision_id and i.item_id = r.item_id
+ }] } {
error "There is no content that matches revision_id '$revision_id'" {} NOT_FOUND
}
} else {
@@ -60,7 +77,11 @@
switch -- $storage_type {
text {
- set text [db_string write_text_content ""]
+ set text [db_string write_text_content {
+ select content
+ from cr_revisions
+ where revision_id = :revision_id
+ }]
if { $string_p } {
return $text
}
@@ -223,11 +244,19 @@
# use content_type of existing item
if {$old_item_p} {
- set content_type [db_string get_content_type ""]
+ set content_type [db_string get_content_type {
+ select content_type
+ from cr_items
+ where item_id = :item_id
+ }]
} else {
# all we really need to know is if the mime type is mapped to image, we
# actually use the passed in image_type or other_type to create the object
- if {[db_string image_type_p "" -default 0]} {
+ if {[db_0or1row image_type_p {
+ select 1 from cr_content_mime_type_map
+ where mime_type = :mime_type
+ and content_type = 'image'
+ }]} {
set content_type image
} else {
set content_type content_revision
@@ -237,15 +266,42 @@
db_transaction {
- if { [db_string is_registered "" -default ""] eq "" } {
- db_dml mime_type_insert ""
- db_exec_plsql mime_type_register ""
+ if { ![db_0or1row is_registered {
+ select 1
+ from cr_content_mime_type_map
+ where mime_type = :mime_type
+ and content_type = 'content_revision'
+ }]} {
+ db_dml mime_type_insert {
+ insert into cr_mime_types (mime_type)
+ select :mime_type
+ from dual
+ where not exists (select 1 from cr_mime_types where mime_type = :mime_type)
+ }
+ db_dml mime_type_register {
+ insert into cr_content_mime_type_map (content_type, mime_type)
+ values ('content_revision', :mime_type)
+ }
}
switch -- $content_type {
image {
- if { [db_string image_subclass ""] == "f" } {
+ if { ![db_0or1row image_subclass {
+ with recursive type_hierarchy as (
+ select object_type, supertype
+ from acs_object_types
+ where object_type = :image_type
+ union all
+ select s.object_type, s.supertype
+ from acs_object_types s,
+ type_hierarchy h
+ where h.object_type <> 'image'
+ and s.object_type = h.supertype
+ )
+ select 1 from type_hierarchy
+ where object_type = 'image'
+ }]} {
error "Image file must be stored in an image object"
}
@@ -286,7 +342,21 @@
error "The file you uploaded was not an image (.gif, .jpg or .jpeg) file"
}
- if { [db_string content_revision_subclass ""] == "f" } {
+ if { ![db_0or1row content_revision_subclass {
+ with recursive type_hierarchy as (
+ select object_type, supertype
+ from acs_object_types
+ where object_type = :other_type
+ union all
+ select s.object_type, s.supertype
+ from acs_object_types s,
+ type_hierarchy h
+ where h.object_type <> 'content_revision'
+ and s.object_type = h.supertype
+ )
+ select 1 from type_hierarchy
+ where object_type = 'content_revision'
+ }]} {
error "Content must be stored in a content revision object"
}
@@ -303,7 +373,13 @@
switch -- $storage_type {
file {
set filename [cr_create_content_file $item_id $revision_id $tmp_filename]
- db_dml set_file_content ""
+ db_dml set_file_content {
+ update cr_revisions set
+ content = :filename,
+ mime_type = :mime_type,
+ content_length = :tmp_size
+ where revision_id = :revision_id
+ }
}
lob {
db_dml set_lob_content "" -blob_files [list $tmp_filename]
@@ -353,7 +429,11 @@
@param mime_type param The mime type
} {
- return [db_string registered_type_for_mime_type "" -default ""]
+ return [db_string registered_type_for_mime_type {
+ select content_type
+ from cr_content_mime_type_map
+ where mime_type = :mime_type
+ } -default ""]
}
ad_proc cr_check_mime_type {
@@ -390,11 +470,19 @@
# future. Usages of this proc in the systems are already set to
# give us the path to the file here.
set extension [string tolower [string trimleft [file extension $filename] "."]]
- if {[db_0or1row lookup_mimetype {}]} {
+ if {[db_0or1row lookup_mimetype {
+ select mime_type
+ from cr_extension_mime_type_map
+ where extension = :extension
+ }]} {
return $mime_type
}
set mime_type [string tolower [ns_guesstype $filename]]
- if {[db_0or1row lookup_mimetype {}]} {
+ if {[db_0or1row lookup_mimetype {
+ select mime_type
+ from cr_extension_mime_type_map
+ where extension = :extension
+ }]} {
return $mime_type
}
set allow_mimetype_creation_p \
@@ -426,7 +514,11 @@
return "*/*"
}
- if {[db_0or1row lookup_mimetype {}]} {
+ if {[db_0or1row lookup_mimetype {
+ select mime_type
+ from cr_extension_mime_type_map
+ where extension = :extension
+ }]} {
return $mime_type
} else {
set mime_type [string tolower [ns_guesstype $filename]]
Fisheye: Tag 1.8.2.1 refers to a dead (removed) revision in file `openacs-4/packages/acs-content-repository/tcl/revision-procs.xql'.
Fisheye: No comparison available. Pass `N' to diff?