/[BackupPC]/trunk/bin/BackupPC_updatedb
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/bin/BackupPC_updatedb

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 29 by dpavlin, Sun Jul 31 12:40:51 2005 UTC revision 30 by dpavlin, Sun Jul 31 15:59:19 2005 UTC
# Line 9  use Data::Dumper; Line 9  use Data::Dumper;
9  use Getopt::Std;  use Getopt::Std;
10  use constant BPC_FTYPE_DIR => 5;  use constant BPC_FTYPE_DIR => 5;
11    
12    my $debug = 0;
13  $|=1;  $|=1;
14    
15  my $hosts;  my $hosts;
# Line 272  sub recurseDir($$$$$$$$) { Line 273  sub recurseDir($$$$$$$$) {
273    
274          my ($bpc, $hostname, $backups, $backupNum, $share, $dir, $shareID) = @_;          my ($bpc, $hostname, $backups, $backupNum, $share, $dir, $shareID) = @_;
275    
276  #print STDERR "recurse($hostname,$backupNum,$share,$dir,$shareID)\n";          print STDERR "recurse($hostname,$backupNum,$share,$dir,$shareID)\n" if ($debug >= 1);
277    
278          my ($nr_files, $new_files, $nr_dirs, $new_dirs) = (0,0,0,0);          my ($nr_files, $new_files, $nr_dirs, $new_dirs) = (0,0,0,0);
279    
# Line 306  sub recurseDir($$$$$$$$) { Line 307  sub recurseDir($$$$$$$$) {
307    
308    
309                          if (! $beenThere->{$key} && ! found_in_db(@data)) {                          if (! $beenThere->{$key} && ! found_in_db(@data)) {
310  ##print STDERR "# key: $key [", $beenThere->{$key},"]";                                  print STDERR "# key: $key [", $beenThere->{$key},"]" if ($debug >= 2);
311                                  $sth->{'insert_files'}->execute(@data);                                  $sth->{'insert_files'}->execute(@data);
312                                  if ($filesInBackup->{$path_key}->{'type'} == BPC_FTYPE_DIR) {                                  if ($filesInBackup->{$path_key}->{'type'} == BPC_FTYPE_DIR) {
313                                          $new_dirs++;                                          $new_dirs++;
314  ##print STDERR " dir\n";                                          print STDERR " dir\n" if ($debug >= 2);
315                                  } else {                                  } else {
316                                          $new_files++;                                          $new_files++;
317  ##print STDERR " file\n";                                          print STDERR " file\n" if ($debug >= 2);
318                                  }                                  }
319                          }                          }
320                          $beenThere->{$key}++;                          $beenThere->{$key}++;
# Line 323  sub recurseDir($$$$$$$$) { Line 324  sub recurseDir($$$$$$$$) {
324    
325                                  my $full_path = $dir . '/' . $path_key;                                  my $full_path = $dir . '/' . $path_key;
326                                  push @stack, $full_path;                                  push @stack, $full_path;
327  ##print STDERR "### store to stack: $full_path\n";                                  print STDERR "### store to stack: $full_path\n" if ($debug >= 3);
328    
329  #                               my ($f,$nf,$d,$nd) = recurseDir($bpc, $hostname, $backups, $backupNum, $share, $path_key, $shareID) unless ($beenThere->{$key});  #                               my ($f,$nf,$d,$nd) = recurseDir($bpc, $hostname, $backups, $backupNum, $share, $path_key, $shareID) unless ($beenThere->{$key});
330  #  #
# Line 337  sub recurseDir($$$$$$$$) { Line 338  sub recurseDir($$$$$$$$) {
338                          }                          }
339                  }                  }
340    
341  ##print STDERR "# STACK ",join(", ", @stack),"\n";                  print STDERR "## STACK ",join(", ", @stack),"\n" if ($debug >= 2);
342    
343                  while ( my $dir = shift @stack ) {                  while ( my $dir = shift @stack ) {
344                          my ($f,$nf,$d,$nd) = recurseDir($bpc, $hostname, $backups, $backupNum, $share, $dir, $shareID);                          my ($f,$nf,$d,$nd) = recurseDir($bpc, $hostname, $backups, $backupNum, $share, $dir, $shareID);
345  #       print STDERR "## $dir f: $f nf: $nf d: $d nd: $nd\n";                          print STDERR "# $dir f: $f nf: $nf d: $d nd: $nd\n" if ($debug >= 1);
346                          $nr_files += $f;                          $nr_files += $f;
347                          $new_files += $nf;                          $new_files += $nf;
348                          $nr_dirs += $d;                          $nr_dirs += $d;

Legend:
Removed from v.29  
changed lines
  Added in v.30

  ViewVC Help
Powered by ViewVC 1.1.26