cr_check_orphaned_files (private, deprecated)

 cr_check_orphaned_files [ -delete ] [ -mtime mtime ]

Defined in packages/acs-content-repository/tcl/acs-content-repository-procs.tcl

Deprecated. Invoking this procedure generates a warning.

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 is being aborted. This function is intended to be used for one-time maintenance operations. Starting with 5.8.1, OpenACS contains support for handling orphaned files much more efficiently via a transaction log that is checked via cr_cleanup_orphaned_files in cr_delete_scheduled_files.

Switches:
-delete (optional, boolean)
delete the orphaned files
-mtime (optional)
same semantics as mtime in the file command
Author:
gustaf.neumann@wu-wien.ac.at

Partial Call Graph (max 5 caller/called nodes):
%3 ad_log_deprecated ad_log_deprecated (public) cr_count_file_entries cr_count_file_entries (private) util::which util::which (public) cr_check_orphaned_files cr_check_orphaned_files cr_check_orphaned_files->ad_log_deprecated cr_check_orphaned_files->cr_count_file_entries cr_check_orphaned_files->util::which

Testcases:
No testcase defined.
Source code:
ad_log_deprecated proc cr_check_orphaned_files
    set cr_root [nsv_get CR_LOCATIONS CR_FILES]
    set root_length [string length $cr_root]
    set result ""

    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]
        if {![regexp {^[0-9/]+$} $name]} continue

        # For every file in the content repository directory, check if this
        # file is still referenced from the content-revisions.

        set x [cr_count_file_entries $name]
        if {$x > 0} continue

        lappend result $f
        if {$delete_p} {
            file delete -- $f
        }
    }

    return $result
Generic XQL file:
packages/acs-content-repository/tcl/acs-content-repository-procs.xql

PostgreSQL XQL file:
packages/acs-content-repository/tcl/acs-content-repository-procs-postgresql.xql

Oracle XQL file:
packages/acs-content-repository/tcl/acs-content-repository-procs-oracle.xql

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