fs::publish_versioned_object_to_file_system (public)

 fs::publish_versioned_object_to_file_system -object_id object_id \
    [ -path path ] [ -file_name file_name ]

Defined in packages/file-storage/tcl/file-storage-procs.tcl

publish an object to the filesystem

Switches:
-object_id (required)
-path (optional)
-file_name (optional)

Partial Call Graph (max 5 caller/called nodes):
%3 test_fs_publish_file fs_publish_file (test file-storage) fs::publish_versioned_object_to_file_system fs::publish_versioned_object_to_file_system test_fs_publish_file->fs::publish_versioned_object_to_file_system ad_file ad_file (public) fs::publish_versioned_object_to_file_system->ad_file ad_mktmpdir ad_mktmpdir (public) fs::publish_versioned_object_to_file_system->ad_mktmpdir ad_sanitize_filename ad_sanitize_filename (public) fs::publish_versioned_object_to_file_system->ad_sanitize_filename content::item::get content::item::get (public) fs::publish_versioned_object_to_file_system->content::item::get content::revision::export_to_filesystem content::revision::export_to_filesystem (public) fs::publish_versioned_object_to_file_system->content::revision::export_to_filesystem fs::publish_object_to_file_system fs::publish_object_to_file_system (public) fs::publish_object_to_file_system->fs::publish_versioned_object_to_file_system

Testcases:
fs_publish_file
Source code:
    if {$path eq ""} {
        set path [ad_mktmpdir]
    }

    db_1row select_object_metadata {}

    # After upgrade change title and filename...
    set like_filesystem_p [parameter::get -parameter BehaveLikeFilesystemP -default 1]

    if { $like_filesystem_p } {
        set file_name $title
        if {$file_name eq ""} {
            if {![info exists upload_file_name]} {
                set file_name "unnamedfile"
            } else {
                set file_name $file_upload_name
            }
        } elseif {[content::item::get -item_id $object_id -array_name item_info]} {
            # We make sure that the file_name contains the file
            # extension at the end so that the users default
            # application for that file type can be used

            set mime_type $item_info(mime_type)
            set file_extension [db_string get_extension {
                select file_extension from cr_mime_types where mime_type = :mime_type
            }]

            if { ![regexp "\.$file_extension$" $file_name match] } {
                set file_name "$file_name.$file_extension"
            }
        }
    } else {
        set file_name $file_upload_name
    }

    set file_name [ad_sanitize_filename  -collapse_spaces  -tolower  $file_name]

    set full_filename [ad_file join $path $file_name]
    ::content::revision::export_to_filesystem  -storage_type $storage_type  -revision_id $live_revision  -filename $full_filename

    return $full_filename
Generic XQL file:
<fullquery name="fs::publish_versioned_object_to_file_system.select_object_metadata">
    <querytext>
            select fs_objects.*,
                   cr_items.storage_type,
                   cr_items.storage_area_key,
                   cr_revisions.title
            from fs_objects,
                 cr_items,
                 cr_revisions
            where fs_objects.object_id = :object_id
            and fs_objects.object_id = cr_items.item_id
            and fs_objects.live_revision = cr_revisions.revision_id
        </querytext>
</fullquery>
packages/file-storage/tcl/file-storage-procs.xql

PostgreSQL XQL file:
packages/file-storage/tcl/file-storage-procs-postgresql.xql

Oracle XQL file:
packages/file-storage/tcl/file-storage-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: