fs::delete_file (public)

 fs::delete_file -item_id item_id [ -parent_id parent_id ] \
    [ -no_callback ]

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

Deletes a file and all its revisions. Note that we do not perform filesystem operations here. A trigger on cr_revisions informs the content repository about the deletion and periodic cleanup of files to be deleted is performed in a scheduled procedure.

Switches:
-item_id (required)
-parent_id (optional)
-no_callback (optional, boolean)

Partial Call Graph (max 5 caller/called nodes):
%3 test_fs_add_delete_copy fs_add_delete_copy (test file-storage) fs::delete_file fs::delete_file test_fs_add_delete_copy->fs::delete_file test_fs_add_file_to_folder fs_add_file_to_folder (test file-storage) test_fs_add_file_to_folder->fs::delete_file ad_conn ad_conn (public) fs::delete_file->ad_conn callback callback (public) fs::delete_file->callback db_exec_plsql db_exec_plsql (public) fs::delete_file->db_exec_plsql db_list db_list (public) fs::delete_file->db_list fs::do_notifications fs::do_notifications (public) fs::delete_file->fs::do_notifications fs::delete_version fs::delete_version (public) fs::delete_version->fs::delete_file packages/attachments/www/detach.tcl packages/attachments/ www/detach.tcl packages/attachments/www/detach.tcl->fs::delete_file packages/file-storage/www/delete.tcl packages/file-storage/ www/delete.tcl packages/file-storage/www/delete.tcl->fs::delete_file packages/file-storage/www/move.tcl packages/file-storage/ www/move.tcl packages/file-storage/www/move.tcl->fs::delete_file packages/file-storage/www/simple-delete.tcl packages/file-storage/ www/simple-delete.tcl packages/file-storage/www/simple-delete.tcl->fs::delete_file

Testcases:
fs_add_delete_copy, fs_add_file_to_folder
Source code:

    set version_name [get_object_name -object_id $item_id]

    if {$parent_id eq ""} {
        set parent_id [fs::get_parent -item_id $item_id]
    }

    set folder_info [fs::get_folder_package_and_root $parent_id]
    set package_id [lindex $folder_info 0]

    # check if there were symlinks, if yes, delete them
    set all_symlinks [db_list get_all_symlinks {}]
    foreach symlink_id $all_symlinks {
        fs::delete_file -item_id $symlink_id
    }

    if {!$no_callback_p} {
        callback fs::file_delete  -package_id [ad_conn package_id]  -file_id $item_id
    }

    fs::do_notifications  -folder_id $parent_id  -filename $version_name  -item_id $item_id  -action "delete_file"

    db_exec_plsql delete_file {}
Generic XQL file:
<fullquery name="fs::delete_file.version_name">
    <querytext>
      
    	select i.name as title, r.title as version_name 
	from cr_items i, cr_revisions r
	where i.item_id = r.item_id
	and r.revision_id = :version_id

      </querytext>
</fullquery>

<fullquery name="fs::delete_file.get_all_symlinks">
    <querytext>
		select symlink_id from cr_symlinks
		where target_id=:item_id
	</querytext>
</fullquery>
packages/file-storage/tcl/file-storage-procs.xql

PostgreSQL XQL file:
<fullquery name="fs::delete_file.delete_file">
    <querytext>

	select file_storage__delete_file(
			:item_id
			);
      </querytext>
</fullquery>
packages/file-storage/tcl/file-storage-procs-postgresql.xql

Oracle XQL file:
<fullquery name="fs::delete_file.delete_file">
    <querytext>
	
	
	begin
	    file_storage.delete_file(
			:item_id
			);
	end;

      </querytext>
</fullquery>
packages/file-storage/tcl/file-storage-procs-oracle.xql

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