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):
- 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