Index: openacs-4/packages/file-storage/www/move-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/Attic/move-oracle.xql,v diff -u -r1.8 -r1.9 --- openacs-4/packages/file-storage/www/move-oracle.xql 9 Dec 2008 09:02:31 -0000 1.8 +++ openacs-4/packages/file-storage/www/move-oracle.xql 3 Nov 2017 15:58:29 -0000 1.9 @@ -23,30 +23,6 @@ - - - begin - :1 := file_storage.copy_file( - :object_id, - :folder_id, - :user_id, - :peer_addr - ); - end; - - - - - - begin - content_item.move( - :object_id, - :folder_id - ); - end; - - - select Index: openacs-4/packages/file-storage/www/move-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/Attic/move-postgresql.xql,v diff -u -r1.10 -r1.11 --- openacs-4/packages/file-storage/www/move-postgresql.xql 7 Aug 2017 23:48:11 -0000 1.10 +++ openacs-4/packages/file-storage/www/move-postgresql.xql 3 Nov 2017 15:58:29 -0000 1.11 @@ -23,15 +23,6 @@ - - - select content_item__move( - :object_id, - :folder_id - ) - - - select @@ -64,34 +55,4 @@ - - - select file_storage__copy_file( - :object_id, - :folder_id, - :user_id, - :peer_addr - ) - - - - - - select content_folder__copy ( - :object_id, - :folder_id, - :user_id, - :peer_addr - ) - - - - - - select count(*) from cr_items - where name=:name - and parent_id=:folder_id - - - Index: openacs-4/packages/file-storage/www/move.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/move.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/file-storage/www/move.tcl 7 Aug 2017 23:48:11 -0000 1.11 +++ openacs-4/packages/file-storage/www/move.tcl 3 Nov 2017 15:58:29 -0000 1.12 @@ -65,33 +65,41 @@ # but the existing file-move page checks for WRITE set error_items {} template::multirow foreach move_objects { - if {[db_string item_exists_already_in_target_folder {}]} { + + if {[content::item::get_id_by_name \ + -name $name -parent_id $folder_id] ne ""} { ns_log Notice "item $name exists already in folder $folder_id" lappend error_items $name } else { - if {$copy_and_delete_p} { - # copy and delete file to move it - db_transaction { + db_transaction { + if {$copy_and_delete_p} { + # copy and delete file to move it + set file_id [content::item::copy -item_id $object_id \ + -target_folder_id $folder_id \ + -creation_user $user_id \ + -creation_ip $peer_addr] if {$type ne "folder" } { - set file_rev_id [db_exec_plsql copy_item {}] - set file_id [content::revision::item_id -revision_id $file_rev_id] - callback fs::file_revision_new -package_id $package_id -file_id $file_id -parent_id $folder_id - fs::delete_file -item_id $object_id -parent_id $parent_id + callback fs::file_revision_new \ + -package_id $package_id \ + -file_id $file_id \ + -parent_id $folder_id + fs::delete_file \ + -item_id $object_id \ + -parent_id $parent_id } else { - db_exec_plsql copy_folder {} - fs::delete_folder -folder_id $object_id -parent_id $parent_id + fs::delete_folder \ + -folder_id $object_id \ + -parent_id $parent_id } - } on_error { - lappend error_items $name + } else { + # execute move command + content::item::move \ + -item_id $object_id \ + -target_folder_id $folder_id } - } else { - # execute move command - db_transaction { - db_exec_plsql move_item {} - } on_error { - lappend error_items $name - } - } + } on_error { + lappend error_items $name + } } }