From 5e96c5116256a42afd5b574a5c575560a1fe5df6 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Mon, 3 Jan 2011 17:13:43 +0000 Subject: [PATCH] added BackupPC::View only_first option this allows bin/BackupPC_updatedb to interate over just new files for increment --- bin/BackupPC_updatedb | 6 +++--- lib/BackupPC/View.pm | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/BackupPC_updatedb b/bin/BackupPC_updatedb index e72ba3d..d28096c 100755 --- a/bin/BackupPC_updatedb +++ b/bin/BackupPC_updatedb @@ -1,8 +1,7 @@ #!/usr/bin/perl use strict; -#use lib "/data/backuppc/lib"; -use lib "/usr/share/backuppc/lib"; +use lib "/usr/local/BackupPC/lib"; use DBI; use BackupPC::Lib; @@ -552,7 +551,8 @@ warn "XXXX ",dump(@backups); ); print $share_header unless ($opt{q}); - my $files = BackupPC::View->new($bpc, $hostname, \@backups, 1); + my $files = BackupPC::View->new($bpc, $hostname, \@backups, { only_first => 1 }); + foreach my $share ($files->shareList($backupNum)) { my $t = time(); diff --git a/lib/BackupPC/View.pm b/lib/BackupPC/View.pm index 1c21ba8..3f56841 100644 --- a/lib/BackupPC/View.pm +++ b/lib/BackupPC/View.pm @@ -105,6 +105,9 @@ sub dirCache # next if ( $m->{backups}[$i]{level} >= $level ); + last if exists $m->{dirOpts}->{only_first} && $i != $m->{idx}; + # used by bin/BackupPC_updatedb to extract just first increment + $level = $m->{backups}[$i]{level}; $backupNum = $m->{backups}[$i]{num}; push(@{$m->{mergeNums}}, $backupNum); -- 2.20.1