- commit just for debugging purposes - something is wrong with determining total_size...
[BackupPC.git] / lib / BackupPC / SearchLib.pm
index 884375d..f3b1aac 100644 (file)
@@ -20,6 +20,10 @@ my $db_user = $Conf{SearchUser} || '';
 my $hest_node_url = $Conf{HyperEstraierIndex};
 
 my $dbh;
+open(LOG, ">>", "$Dir/LOG")
+select(LOG);
+$|=1;
+
 
 sub get_dbh {
        $dbh ||= DBI->connect($dsn, $db_user, "", { RaiseError => 1, AutoCommit => 1 } );
@@ -376,18 +380,24 @@ sub get_tgz_size_by_name($) {
        my $name = shift;
 
        my $tgz = $Conf{InstallDir}.'/'.$Conf{GzipTempDir}.'/'.$name;
-
        my $size = -1;
 
        if (-f "${tgz}.tar.gz") {
+               print "stating ${tgz}.tar.gz...";
                $size = (stat("${tgz}.tar.gz"))[7];
+               print "size: $size\n";
        } elsif (-d $tgz) {
+               print "$tgz is dir, stating files in it...\n";
                opendir(my $dir, $tgz) || die "can't opendir $tgz: $!";
                my @parts = grep { !/^\./ && !/md5/ && -f "$tgz/$_" } readdir($dir);
                $size = 0;
                foreach my $part (@parts) {
+                       my $currSize =  (stat("$tgz/$part"))[7]; 
                        $size += (stat("$tgz/$part"))[7] || die "can't stat $tgz/$part: $!";
+                       print "\t$tgz/$part: $currSize\n";
                }
+               print "\ttotal $size\n";
+
                closedir $dir;
        } else {
                return -1;