160 |
my $sth_inc_size = $dbh->prepare(qq{ |
my $sth_inc_size = $dbh->prepare(qq{ |
161 |
update backups set |
update backups set |
162 |
inc_size = ?, |
inc_size = ?, |
|
parts = ?, |
|
163 |
inc_deleted = false |
inc_deleted = false |
164 |
where id = ? |
where id = ? |
165 |
}); |
}); |
251 |
if ($fh) { |
if ($fh) { |
252 |
return if ($current_tar_size == 0); |
return if ($current_tar_size == 0); |
253 |
|
|
254 |
print STDERR " $part"; |
print STDERR "\n\t+ $part:"; |
255 |
|
|
256 |
# |
# |
257 |
# Finish with two null 512 byte headers, |
# Finish with two null 512 byte headers, |
270 |
|
|
271 |
my $size = (stat( $file . '.tar.gz' ))[7] || die "can't stat ${file}.tar.gz"; |
my $size = (stat( $file . '.tar.gz' ))[7] || die "can't stat ${file}.tar.gz"; |
272 |
|
|
273 |
|
print "$file, $size bytes, $items_in_part items"; |
274 |
|
|
275 |
$sth_backup_parts->execute( |
$sth_backup_parts->execute( |
276 |
$backup_id, |
$backup_id, |
277 |
$part, |
$part, |
309 |
|
|
310 |
$sth_inc_size->execute( |
$sth_inc_size->execute( |
311 |
$total_increment_size, |
$total_increment_size, |
|
$part, |
|
312 |
$backup_id |
$backup_id |
313 |
); |
); |
314 |
|
|
315 |
print STDERR ", $total_increment_size bytes\n" if ($opts{v}); |
print "\n\ttotal $total_increment_size bytes"; |
316 |
|
|
317 |
return; |
return; |
318 |
} |
} |
331 |
mkdir($tar_path) || die "can't create directory $tar_path: $!"; |
mkdir($tar_path) || die "can't create directory $tar_path: $!"; |
332 |
|
|
333 |
sub abort_cleanup { |
sub abort_cleanup { |
334 |
print STDERR "ABORTED: cleanup temp dir"; |
print STDERR "ABORTED: cleanup temp dir "; |
335 |
rmtree($tar_path); |
rmtree($tar_path); |
336 |
$dbh->rollback; |
$dbh->rollback; |
337 |
exit 1; |
exit 1; |
374 |
print STDERR "NOTE: no files found for $Host:$ShareName, increment $Num\n" if ($opts{v}); |
print STDERR "NOTE: no files found for $Host:$ShareName, increment $Num\n" if ($opts{v}); |
375 |
# remove temporary files if there are no files |
# remove temporary files if there are no files |
376 |
rmtree($tar_path); |
rmtree($tar_path); |
377 |
|
|
378 |
|
my $sth = $dbh->prepare(qq{ |
379 |
|
update backups set inc_size = 0, inc_deleted = true |
380 |
|
where id = ? |
381 |
|
}); |
382 |
|
$sth->execute($backup_id); |
383 |
|
|
384 |
} |
} |
385 |
|
|
386 |
# |
# |