use Getopt::Std;
use constant BPC_FTYPE_DIR => 5;
+my $debug = 0;
$|=1;
my $hosts;
my ($bpc, $hostname, $backups, $backupNum, $share, $dir, $shareID) = @_;
-#print STDERR "recurse($hostname,$backupNum,$share,$dir,$shareID)\n";
+ print STDERR "recurse($hostname,$backupNum,$share,$dir,$shareID)\n" if ($debug >= 1);
my ($nr_files, $new_files, $nr_dirs, $new_dirs) = (0,0,0,0);
if (! $beenThere->{$key} && ! found_in_db(@data)) {
-##print STDERR "# key: $key [", $beenThere->{$key},"]";
+ print STDERR "# key: $key [", $beenThere->{$key},"]" if ($debug >= 2);
$sth->{'insert_files'}->execute(@data);
if ($filesInBackup->{$path_key}->{'type'} == BPC_FTYPE_DIR) {
$new_dirs++;
-##print STDERR " dir\n";
+ print STDERR " dir\n" if ($debug >= 2);
} else {
$new_files++;
-##print STDERR " file\n";
+ print STDERR " file\n" if ($debug >= 2);
}
}
$beenThere->{$key}++;
my $full_path = $dir . '/' . $path_key;
push @stack, $full_path;
-##print STDERR "### store to stack: $full_path\n";
+ print STDERR "### store to stack: $full_path\n" if ($debug >= 3);
# my ($f,$nf,$d,$nd) = recurseDir($bpc, $hostname, $backups, $backupNum, $share, $path_key, $shareID) unless ($beenThere->{$key});
#
}
}
-##print STDERR "# STACK ",join(", ", @stack),"\n";
+ print STDERR "## STACK ",join(", ", @stack),"\n" if ($debug >= 2);
while ( my $dir = shift @stack ) {
my ($f,$nf,$d,$nd) = recurseDir($bpc, $hostname, $backups, $backupNum, $share, $dir, $shareID);
-# 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);
$nr_files += $f;
$new_files += $nf;
$nr_dirs += $d;