Index: openacs-4/packages/acs-content-repository/tcl/acs-content-repository-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/acs-content-repository-procs.tcl,v diff -u -r1.13 -r1.14 --- openacs-4/packages/acs-content-repository/tcl/acs-content-repository-procs.tcl 25 Jul 2018 17:44:25 -0000 1.13 +++ openacs-4/packages/acs-content-repository/tcl/acs-content-repository-procs.tcl 3 Sep 2024 15:37:31 -0000 1.14 @@ -1,18 +1,19 @@ -# tcl/acs-content-repository-procs.tcl patch -# -# a patch to the cr for handling the deleting revision's files -# when the revision has been deleted from the database -# -# Walter McGinnis (wtem@olywa.net), 2001-09-23 -# based on original photo-album package code by Tom Baginski -# -# JCD 2002-12-96 This should be fixed since on oracle anyway, being in a -# transaction does not mean that you get read level consistency across -# queries. End result is that someone can do an insert into the -# delete list and the delete_files query will whack it and the file -# will then never be deleted. Oops. +ad_library { + tcl/acs-content-repository-procs.tcl patch + a patch to the cr for handling the deleting revision's files + when the revision has been deleted from the database + Walter McGinnis (wtem@olywa.net), 2001-09-23 + based on original photo-album package code by Tom Baginski + + JCD 2002-12-96 This should be fixed since on oracle anyway, being in a + transaction does not mean that you get read level consistency across + queries. End result is that someone can do an insert into the + delete list and the delete_files query will whack it and the file + will then never be deleted. Oops. +} + ad_proc -private cr_delete_scheduled_files {} { Tries to delete all the files in cr_files_to_delete. Makes sure file isn't being used by another revision prior to deleting it. @@ -46,26 +47,28 @@ cr_cleanup_orphaned_files } +ad_proc -private cr_cleanup_orphaned_files {} { + Helper proc to cleanup orphaned files in the content + repository. Orphaned files can be created during aborted + transactions involving the files being added to the content + repository. -## -## Scan AOLserver mime types and insert them into cr_mime_types -## -## ben@openforce -## +} { + cr_delete_orphans [cr_get_file_creation_log] +} ad_proc -private cr_scan_mime_types {} { + Scan AOLserver mime types and insert them into cr_mime_types + + @author ben@openforce +} { # Get the config file ns_set set mime_types [ns_configsection "ns/mimetypes"] if {$mime_types ne ""} { - set n_mime_types [ns_set size $mime_types] - - for {set i 0} {$i < $n_mime_types} {incr i} { - set extension [ns_set key $mime_types $i] - set mime_type [ns_set value $mime_types $i] - + foreach {extension mime_type} [ns_set array $mime_types] { # special case - if {$extension eq "NoExtension" || $extension eq "Default"} { + if {$extension in {"NoExtension" "Default"}} { continue } @@ -76,16 +79,10 @@ } } -## -## Check for orphans in the content repository directory, and delete -## such files if required. -## -## gustaf.neumann@wu-wien.ac.at -## - - -ad_proc cr_check_orphaned_files {-delete:boolean {-mtime ""}} { - +ad_proc -private -deprecated cr_check_orphaned_files { + -delete:boolean + {-mtime ""} +} { Check for orphaned files in the content repository directory, and delete such files if required. Orphaned files might be created, when files are added to the content repository, but the transaction @@ -98,12 +95,13 @@ @param delete delete the orphaned files @param mtime same semantics as mtime in the file command + @author gustaf.neumann@wu-wien.ac.at } { set cr_root [nsv_get CR_LOCATIONS CR_FILES] set root_length [string length $cr_root] set result "" - set cmd [list exec find $cr_root/ -type f] + set cmd [list exec [util::which find] $cr_root/ -type f] if {$mtime ne ""} {lappend cmd -mtime $mtime} foreach f [split [{*}$cmd] \n] { set name [string range $f $root_length end] @@ -124,6 +122,14 @@ return $result } +ad_proc -private acs_cr_scheduled_release_exec {} { + This was handled by oracle, but since other dbs, such as + PostgreSQL don't support job submission, the job scheduling has + been moved to aolserver. (OpenACS - DanW) +} { + db_exec_plsql schedule_releases {} +} + # # Local variables: # mode: tcl