From d649456cfe30427720c26595f4dbf53423642144 Mon Sep 17 00:00:00 2001 From: hummypkg Date: Fri, 18 Jan 2013 19:24:50 +0000 Subject: [PATCH] finish recursive handling git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1358 2a923420-c742-0410-a762-8d5b09965624 --- var/mongoose/cgi-bin/browse/browse.js | 8 +++++++ var/mongoose/lib/bin/auto | 32 ++++++++++++++++++--------- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/var/mongoose/cgi-bin/browse/browse.js b/var/mongoose/cgi-bin/browse/browse.js index 4e2c3f6c..227515f3 100755 --- a/var/mongoose/cgi-bin/browse/browse.js +++ b/var/mongoose/cgi-bin/browse/browse.js @@ -553,10 +553,18 @@ var dmenuclick = function(action, el, pos) flagdir(file, 'autoshrink', iconset, results, el); break; + case 'shrinkr': + flagdir(file, 'autoshrinkr', iconset, results, el); + break; + case 'decrypt': flagdir(file, 'autodecrypt', iconset, results, el); break; + case 'decryptr': + flagdir(file, 'autodecryptr', iconset, results, el); + break; + case 'resetnew': var url = '/cgi-bin/browse/resetnew.jim?dir=' + file; $.get(url, function() { window.location.reload(true); }); diff --git a/var/mongoose/lib/bin/auto b/var/mongoose/lib/bin/auto index b16af865..54e78469 100755 --- a/var/mongoose/lib/bin/auto +++ b/var/mongoose/lib/bin/auto @@ -3,6 +3,8 @@ source /mod/webif/lib/setup require lock system.class ts.class tdelete +set testing 0 + proc dsc {} { lassign [system diskspace] x x perc if {$perc > 90} { @@ -47,9 +49,12 @@ proc bindir {file binroot} { } proc dedup {dir} { - #puts "DEDUP: \[$dir]" - puts [exec /mod/webif/html/dedup/dedup -yes $dir] - exec /mod/webif/html/dedup/dedup -yes $dir + if {$::testing} { + puts "DEDUP: \[$dir]" + } else { + puts [exec /mod/webif/html/dedup/dedup -yes $dir] + exec /mod/webif/html/dedup/dedup -yes $dir + } } proc do_shrink {ts} { @@ -223,32 +228,39 @@ proc entries {dir callback} { proc shrink {dir} { puts "SHRINK: \[$dir]" - entries $dir do_shrink + if {!$::testing} { entries $dir do_shrink } } proc decrypt {dir} { puts "DECRYPT: \[$dir]" - entries $dir do_decrypt + if {!$::testing} { entries $dir do_decrypt } } proc mpg {dir} { puts "MPG: \[$dir]" - entries $dir do_mpg + if {!$::testing} { entries $dir do_mpg } } -proc scan {dir attr} {{indent 0}} { +proc scan {dir attr {force 0}} {{indent 0}} { incr indent 2 - #puts "[string repeat " " $indent]\[$dir]" + if {$::testing} { puts "[string repeat " " $indent]\[$dir]" } if {[string match {\[*} $dir]} continue dsc - if {[file exists "$dir/.auto$attr"]} { $attr $dir } + + # Recursion + if {[file exists "$dir/.auto${attr}r"]} { + if {$::testing} { puts "[string repeat " " $indent] (R)" } + set force 1 + } + + if {$force || [file exists "$dir/.auto$attr"]} { $attr $dir } foreach entry [readdir -nocomplain $dir] { if {[file isdirectory "$dir/$entry"]} { - scan "$dir/$entry" $attr + scan "$dir/$entry" $attr $force } }