my $selected = 0;
my $parts = 1;
-
foreach my $key(keys(%In)) {
+ print LOG "doing $key...";
if ($key =~ m/^fcb([0-9]+)_([0-9]+)_([0-9]+)$/gi) {
+
my ($host_id, $backup_num, $backup_id) = ($1,$2,$3);
push @selected_backup_ids, $backup_id;
- $total_size += BackupPC::SearchLib::getGzipSize($host_id, $backup_num);
+ my $currSize = BackupPC::SearchLib::getGzipSize($host_id, $backup_num);
+ if ($currSize > 0) {
+ $total_size += currSize;
+ }
$selected++;
my ($this_part) = $dbh->selectrow_array("select parts from backups where id = ?", undef, $backup_id);
$this_part--;
$parts += $this_part;
- }
- }
+ } }
if ($total_size > ($Conf{MaxArchiveSize} * $parts)) {
$cont .= eval( q{ ${h2(Error)}});
my $hest_node_url = $Conf{HyperEstraierIndex};
my $dbh;
-my $Dir = $Conf{InstallDir}."/data/log";
-open(LOG, ">>", "$Dir/LOG")
-select(LOG);
-$|=1;
+
sub get_dbh {
my $tgz = $Conf{InstallDir}.'/'.$Conf{GzipTempDir}.'/'.$name;
my $size = -1;
+ my $Dir = $Conf{InstallDir}."/data/log";
+ $|=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 {