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.7.2.1 -r1.7.2.2 --- openacs-4/packages/acs-content-repository/tcl/acs-content-repository-procs.tcl 25 Dec 2013 12:40:13 -0000 1.7.2.1 +++ openacs-4/packages/acs-content-repository/tcl/acs-content-repository-procs.tcl 25 Dec 2013 16:10:31 -0000 1.7.2.2 @@ -76,28 +76,29 @@ ## -ad_proc cr_check_orphaned_files {-delete:boolean} { +ad_proc cr_check_orphaned_files {-delete:boolean {-mtime ""}} { Check for orphaned files in the content respository directory, and delete such files if required. Orphaned files might be created, when files add added to the content repository, but the transaction is being aborted. @param -delete delete the orphaned files + @param -mtime same semantics as mtime in the file command } { - package require fileutil - set cr_root [nsv_get CR_LOCATIONS CR_FILES] set root_length [string length $cr_root] set result "" # For every file in the content respository directory, check if this # file is still referenced from the content-revisions. - foreach f [::fileutil::find $cr_root "file isfile"] { + set cmd [list exec 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] if {![regexp {^[0-9/]+$} $name]} continue - set x [db_string _ {select count(*) from cr_revisions where content = :name}] + set x [db_string fetch_path { *SQL* }] if {$x > 0} continue lappend result $f