cr_write_content-file (private)
cr_write_content-file [ -string ] [ -item_id item_id ] \ [ -revision_id revision_id ] [ -mime_type mime_type ] \ [ -content content ] [ -content_length content_length ] \ [ -storage_area_key storage_area_key ]
Defined in packages/acs-content-repository/tcl/revision-procs.tcl
- Switches:
- -string (optional, boolean)
- -item_id (optional)
- -revision_id (optional)
- -mime_type (optional)
- -content (optional)
- -content_length (optional)
- -storage_area_key (optional)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: set path [cr_fs_path $storage_area_key] if {[db_type] eq "oracle"} { # # CR datamodel for Oracle differs from the one in Postgres # concerning file revisions. For Oracle, an additional column # cr_revisions.filename stores the actual filename. # set filename [db_string write_file_content {}] } else { set filename $path$content } # ## Note # # in many cases, filename will equal the following idiom: # # set filename ${path}[::cr_create_content_file_path $item_id $revision_id] # # but not in the case of copies. Copies will point to the # filesystem file of the original item. # if {$filename eq ""} { error "No content for the revision $revision_id. This seems to be an error which occurred during the upload of the file" } elseif {![file readable $filename]} { ns_log Error "Could not read file $filename. Maybe the content repository is (partially) missing?" ns_return 404 text/plain {} } elseif { $string_p } { set fd [open $filename "r"] fconfigure $fd -translation binary -encoding [encoding system] set text [read $fd] close $fd return $text } else { # JCD: for webdavfs there needs to be a content-length 0 header # but ns_returnfile does not send one. Also, we need to # ns_return size 0 files since if fastpath is enabled ns_returnfile # simply closes the connection rather than send anything (including # any headers). This bug is fixed in AOLServer 4.0.6 and later # but work around it for now. set size [file size $filename] if {$size == 0} { ns_set iupdate [ns_conn outputheaders] "Content-Length" 0 ns_return 200 text/plain {} } else { ::security::csp::add_static_resource_header -mime_type $mime_type if {[namespace which ad_returnfile_background] eq "" || [security::secure_conn_p]} { ns_returnfile 200 $mime_type $filename } else { ad_returnfile_background 200 $mime_type $filename } } }XQL Not present: Generic PostgreSQL XQL file: <fullquery name="cr_write_content-file.write_file_content"> <querytext> select :path || content from cr_revisions where revision_id = :revision_id </querytext> </fullquery>packages/acs-content-repository/tcl/revision-procs-postgresql.xql
Oracle XQL file: <fullquery name="cr_write_content-file.write_file_content"> <querytext> select :path || filename from cr_revisions where revision_id = :revision_id </querytext> </fullquery>packages/acs-content-repository/tcl/revision-procs-oracle.xql