content::revision::check_files (private)

 content::revision::check_files [ -max_results max_results ] \
    [ -max_checks max_checks ] [ -returnlist ]

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

Figure out, how many files in the CR are not linked to the revisions in the content repository, and report them optionally.

Switches:
-max_results (optional, defaults to "5000")
stop after having found so many non-referenced files
-max_checks (optional, defaults to "10000")
stop after having checked so many non-referenced files
-returnlist (optional, boolean)
return the non-referenced files as part of the result
Author:
Gustaf Neumann

Partial Call Graph (max 5 caller/called nodes):
%3 cr_count_file_entries cr_count_file_entries (private) cr_fs_path cr_fs_path (private) content::revision::check_files content::revision::check_files content::revision::check_files->cr_count_file_entries content::revision::check_files->cr_fs_path

Testcases:
No testcase defined.
Source code:
    set paths [cr_fs_path CR_FILES]
    set prefix_length [string length $paths]
    set count 1
    set missing 0
    set files {}
    while {[llength $paths] > 0} {
        # get the first path
        set paths [lassign $paths path]
        #ns_log notice "popping path '$path' form paths, remaining [llength $paths]"

        set children [glob -nocomplain -directory $path *]
        foreach child $children {
            if {[file tail $child] in {. ..}} {
                continue
            }
            if {[file isdirectory $child]} {
                #
                # Using "lappend" leads to a breadth-search: might be
                # slow when the directories a huge, since it takes a
                # while until leaves are found.
                #
                #lappend paths $child

                set paths [lreplace $paths -1 -2 $child]
                #ns_log notice "child is dir $child"
            } else {
                set suffix [string range $child $prefix_length end]
                set success [cr_count_file_entries $suffix]
                if {$success == 0} {
                    ns_log notice "check_files: $count file $child not in db entries"
                    incr missing
                    lappend files $child
                }
                incr count
                if {$count >= $max_checks || $missing >= $max_results} break

            }
        }
        if {$count >= $max_checks || $missing >= $max_results} break
    }
    set msg "$missing of $count files are not ok (not contained in db entries)"
    if {$returnlist_p} {
        append msg \n [join $files \n]
    }
    return $msg
Generic XQL file:
packages/acs-content-repository/tcl/content-revision-procs.xql

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

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

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