9 |
use Getopt::Std; |
use Getopt::Std; |
10 |
use constant BPC_FTYPE_DIR => 5; |
use constant BPC_FTYPE_DIR => 5; |
11 |
|
|
12 |
|
my $debug = 0; |
13 |
$|=1; |
$|=1; |
14 |
|
|
15 |
my $hosts; |
my $hosts; |
273 |
|
|
274 |
my ($bpc, $hostname, $backups, $backupNum, $share, $dir, $shareID) = @_; |
my ($bpc, $hostname, $backups, $backupNum, $share, $dir, $shareID) = @_; |
275 |
|
|
276 |
#print STDERR "recurse($hostname,$backupNum,$share,$dir,$shareID)\n"; |
print STDERR "recurse($hostname,$backupNum,$share,$dir,$shareID)\n" if ($debug >= 1); |
277 |
|
|
278 |
my ($nr_files, $new_files, $nr_dirs, $new_dirs) = (0,0,0,0); |
my ($nr_files, $new_files, $nr_dirs, $new_dirs) = (0,0,0,0); |
279 |
|
|
307 |
|
|
308 |
|
|
309 |
if (! $beenThere->{$key} && ! found_in_db(@data)) { |
if (! $beenThere->{$key} && ! found_in_db(@data)) { |
310 |
##print STDERR "# key: $key [", $beenThere->{$key},"]"; |
print STDERR "# key: $key [", $beenThere->{$key},"]" if ($debug >= 2); |
311 |
$sth->{'insert_files'}->execute(@data); |
$sth->{'insert_files'}->execute(@data); |
312 |
if ($filesInBackup->{$path_key}->{'type'} == BPC_FTYPE_DIR) { |
if ($filesInBackup->{$path_key}->{'type'} == BPC_FTYPE_DIR) { |
313 |
$new_dirs++; |
$new_dirs++; |
314 |
##print STDERR " dir\n"; |
print STDERR " dir\n" if ($debug >= 2); |
315 |
} else { |
} else { |
316 |
$new_files++; |
$new_files++; |
317 |
##print STDERR " file\n"; |
print STDERR " file\n" if ($debug >= 2); |
318 |
} |
} |
319 |
} |
} |
320 |
$beenThere->{$key}++; |
$beenThere->{$key}++; |
324 |
|
|
325 |
my $full_path = $dir . '/' . $path_key; |
my $full_path = $dir . '/' . $path_key; |
326 |
push @stack, $full_path; |
push @stack, $full_path; |
327 |
##print STDERR "### store to stack: $full_path\n"; |
print STDERR "### store to stack: $full_path\n" if ($debug >= 3); |
328 |
|
|
329 |
# my ($f,$nf,$d,$nd) = recurseDir($bpc, $hostname, $backups, $backupNum, $share, $path_key, $shareID) unless ($beenThere->{$key}); |
# my ($f,$nf,$d,$nd) = recurseDir($bpc, $hostname, $backups, $backupNum, $share, $path_key, $shareID) unless ($beenThere->{$key}); |
330 |
# |
# |
338 |
} |
} |
339 |
} |
} |
340 |
|
|
341 |
##print STDERR "# STACK ",join(", ", @stack),"\n"; |
print STDERR "## STACK ",join(", ", @stack),"\n" if ($debug >= 2); |
342 |
|
|
343 |
while ( my $dir = shift @stack ) { |
while ( my $dir = shift @stack ) { |
344 |
my ($f,$nf,$d,$nd) = recurseDir($bpc, $hostname, $backups, $backupNum, $share, $dir, $shareID); |
my ($f,$nf,$d,$nd) = recurseDir($bpc, $hostname, $backups, $backupNum, $share, $dir, $shareID); |
345 |
# print STDERR "## $dir f: $f nf: $nf d: $d nd: $nd\n"; |
print STDERR "# $dir f: $f nf: $nf d: $d nd: $nd\n" if ($debug >= 1); |
346 |
$nr_files += $f; |
$nr_files += $f; |
347 |
$new_files += $nf; |
$new_files += $nf; |
348 |
$nr_dirs += $d; |
$nr_dirs += $d; |