- $sth->execute( $host );
- if ( $sth->rows == 0 ) {
- warn "no backups to archive on $host\n";
- push @HostList, $host;
- push @BackupList, 0; # fake, but will make full-text update
- }
-
- while ( my $row = $sth->fetchrow_hashref ) {
- warn "+ ", $row->{host}, " ", $row->{num}, "\n";
- push(@HostList, $host);
- push(@BackupList, $row->{num});
- }
+ my $all_backup_numbers;
+ $all_backup_numbers->{ $_->{num} }++ foreach @backups;
+
+ $sth->execute( $host );
+ while ( my $row = $sth->fetchrow_hashref ) {
+ warn "# row ",dump($row) if $debug;
+ $all_backup_numbers->{ $row->{num} } =
+ $row->{inc_deleted} ? 0 :
+ $row->{size} == 0 ? 0 :
+ $row->{inc_size} > 0 ? 0 :
+ $row->{size} > 0 ? 1 :
+ 0;
+ }
+
+ warn "# $host all_backup_numbers = ",dump($all_backup_numbers) if $debug;
+
+ my @backup_nums =
+ sort
+ grep { $all_backup_numbers->{$_} }
+ keys %$all_backup_numbers;
+
+ foreach my $num ( @backup_nums ) {
+ warn "+ $host $num\n";
+ push(@HostList, $host);
+ push(@BackupList, $num);
+ }