fs::publish_folder_to_file_system (public)

 fs::publish_folder_to_file_system -folder_id folder_id [ -path path ] \
    [ -folder_name folder_name ] [ -user_id user_id ]

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

publish the contents of a file storage folder to the filesystem

Switches:
-folder_id (required)
-path (optional)
-folder_name (optional)
-user_id (optional)

Partial Call Graph (max 5 caller/called nodes):
%3 test_fs_publish_file fs_publish_file (test file-storage) fs::publish_folder_to_file_system fs::publish_folder_to_file_system test_fs_publish_file->fs::publish_folder_to_file_system ad_file ad_file (public) fs::publish_folder_to_file_system->ad_file ad_sanitize_filename ad_sanitize_filename (public) fs::publish_folder_to_file_system->ad_sanitize_filename ad_tmpnam ad_tmpnam (public) fs::publish_folder_to_file_system->ad_tmpnam db_foreach db_foreach (public) fs::publish_folder_to_file_system->db_foreach fs::get_object_name fs::get_object_name (public) fs::publish_folder_to_file_system->fs::get_object_name fs::publish_object_to_file_system fs::publish_object_to_file_system (public) fs::publish_object_to_file_system->fs::publish_folder_to_file_system

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

    if {$folder_name eq ""} {
        set folder_name [get_object_name -object_id $folder_id]
    }
    set folder_name [ad_sanitize_filename  -collapse_spaces  -tolower  $folder_name]

    set dir [ad_file join $path $folder_name]
    # set dir [ad_file join $path "download"]
    file mkdir $dir

    db_foreach get_folder_contents {
        select object_id,
               name
          from fs_objects
         where parent_id = :folder_id
           and acs_permission.permission_p(object_id, :user_id, 'read') = 't'
        order by sort_key,
                 name
    } {
        set file_name [ad_sanitize_filename  -collapse_spaces  -tolower  $name]
        publish_object_to_file_system  -object_id $object_id  -path $dir  -file_name $file_name  -user_id $user_id
    }

    return $dir
Generic XQL file:
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: