45 lines
977 B
Plaintext
Executable File
45 lines
977 B
Plaintext
Executable File
|
|
source /mod/webif/lib/setup
|
|
require lock system.class ts.class pretty_size browse.class \
|
|
safe_delete settings.class plugin queue.class
|
|
|
|
proc ::auto::log {msg {level 1}} {
|
|
puts "[\
|
|
clock format [clock seconds] -format "%d/%m/%Y %H:%M"\
|
|
] - $msg"
|
|
}
|
|
|
|
proc ::auto::register {args} {}
|
|
proc ::auto::register_flag {args} {}
|
|
|
|
proc ::auto::flagscan {dir flag callback {seen {}}} {
|
|
variable dustbin
|
|
|
|
if {[string match {\[*} [string trimleft [file tail $dir]]]} return
|
|
|
|
file stat $dir st
|
|
set key "$st(dev):$st(ino)"
|
|
if {$key in $seen} {
|
|
log "Already seen $dir ($key)" 2
|
|
return
|
|
}
|
|
lappend seen $key
|
|
|
|
if {[file exists "$dir/.$flag"]} { $callback $dir }
|
|
|
|
foreach entry [readdir -nocomplain $dir] {
|
|
if {[file isdirectory "$dir/$entry"]} {
|
|
flagscan "$dir/$entry" $flag $callback $seen
|
|
|
|
file stat "$dir/$entry" st
|
|
set key "$st(dev):$st(ino)"
|
|
lappend seen $key
|
|
}
|
|
}
|
|
}
|
|
|
|
set ::auto::root [system mediaroot]
|
|
|
|
source /mod/webif/plugin/sweeper/auto.hook
|
|
|