/[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 38 by dpavlin, Fri Aug 19 15:27:27 2005 UTC revision 82 by dpavlin, Sun Aug 28 09:12:54 2005 UTC
# Line 1  Line 1 
1  #!/usr/local/bin/perl -w  #!/usr/local/bin/perl -w
2    
3  use strict;  use strict;
 use DBI;  
4  use lib "__INSTALLDIR__/lib";  use lib "__INSTALLDIR__/lib";
5    
6    use DBI;
7  use BackupPC::Lib;  use BackupPC::Lib;
8  use BackupPC::View;  use BackupPC::View;
9  use Data::Dumper;  use Data::Dumper;
# Line 10  use Getopt::Std; Line 11  use Getopt::Std;
11  use Time::HiRes qw/time/;  use Time::HiRes qw/time/;
12  use File::Pid;  use File::Pid;
13  use POSIX qw/strftime/;  use POSIX qw/strftime/;
14    
15  use constant BPC_FTYPE_DIR => 5;  use constant BPC_FTYPE_DIR => 5;
16    
17  my $debug = 0;  my $debug = 0;
18  $|=1;  $|=1;
19    
20    my $start_t = time();
21    
22  my $pidfile = new File::Pid;  my $pidfile = new File::Pid;
23    
24  if (my $pid = $pidfile->running ) {  if (my $pid = $pidfile->running ) {
# Line 22  if (my $pid = $pidfile->running ) { Line 26  if (my $pid = $pidfile->running ) {
26  } elsif ($pidfile->pid ne $$) {  } elsif ($pidfile->pid ne $$) {
27          $pidfile->remove;          $pidfile->remove;
28          $pidfile = new File::Pid;          $pidfile = new File::Pid;
         $pidfile->write;  
         print STDERR "$0 using pid ",$pidfile->pid," file ",$pidfile->file,"\n";  
29  }  }
30    $pidfile->write;
31    print STDERR "$0 using pid ",$pidfile->pid," file ",$pidfile->file,"\n";
32    
33  my $t_fmt = '%Y-%m-%d %H:%M:%S';  my $t_fmt = '%Y-%m-%d %H:%M:%S';
34    
# Line 34  my %Conf = $bpc->Conf(); Line 38  my %Conf = $bpc->Conf();
38  my $TopDir = $bpc->TopDir();  my $TopDir = $bpc->TopDir();
39  my $beenThere = {};  my $beenThere = {};
40    
41  my $dsn = "dbi:SQLite:dbname=$TopDir/$Conf{SearchDB}";  my $dsn = $Conf{SearchDSN} || die "Need SearchDSN in config.pl\n";
42    my $user = $Conf{SearchUser} || '';
43    my $index_path = $Conf{HyperEstraierIndex};
44    
45  my $dbh = DBI->connect($dsn, "", "", { RaiseError => 1, AutoCommit => 0 });  my $dbh = DBI->connect($dsn, $user, "", { RaiseError => 1, AutoCommit => 0 });
46    
47  my %opt;  my %opt;
48    
49  if ( !getopts("cdm:v", \%opt ) ) {  if ( !getopts("cdm:v:i", \%opt ) ) {
50          print STDERR <<EOF;          print STDERR <<EOF;
51  usage: $0 [-c|-d] [-m num]  usage: $0 [-c|-d] [-m num] [-v|-v level] [-i]
52    
53  Options:  Options:
54          -c      create database on first use          -c      create database on first use
55          -d      delete database before import          -d      delete database before import
56          -m num  import just num increments for one host          -m num  import just num increments for one host
57            -v num  set verbosity (debug) level (default $debug)
58            -i      update HyperEstraier full text index
59  EOF  EOF
60          exit 1;          exit 1;
61  }  }
62    
63    if ($opt{v}) {
64            print "Debug level at $opt{v}\n";
65            $debug = $opt{v};
66    }
67    
68    ## update index ##
69    if ($opt{i}) {
70    
71            print "updating HyperEstraier files ";
72            
73            my $sth = $dbh->prepare(qq{
74                    SELECT
75                            files.id                        AS fid,
76                            hosts.name                      AS hname,
77                            shares.name                     AS sname,
78                            shares.share                    AS sharename,
79                            files.backupNum                 AS backupNum,
80                            files.name                      AS filename,
81                            files.path                      AS filepath,
82                            files.date                      AS date,
83                            files.type                      AS filetype,
84                            files.size                      AS size,
85                            files.shareid                   AS shareid
86                    FROM files
87                            INNER JOIN shares       ON files.shareID=shares.ID
88                            INNER JOIN hosts        ON hosts.ID = shares.hostID
89                            INNER JOIN backups      ON backups.num = files.backupNum and backups.hostID = hosts.ID AND backups.shareID = shares.ID
90            });
91    
92            $sth->execute();
93    
94            my $dot = int($sth->rows / 15);
95    
96            print $sth->rows, " files ($dot/#) ";
97    
98            sub fmt_date {
99                    my $t = shift || return;
100                    my $iso = BackupPC::Lib::timeStamp($t);
101                    $iso =~ s/\s/T/;
102                    return $iso;
103            }
104    
105            my $i = 0;
106            my $max = int($sth->rows / $dot);
107    
108            $index_path = $TopDir . '/' . $index_path;
109            $index_path =~ s#//#/#g;
110    
111            print "index $index_path...";
112            use HyperEstraier;
113            my $db = HyperEstraier::Database->new();
114            $db->open($index_path, $HyperEstraier::Database::DBWRITER | $HyperEstraier::Database::DBCREAT);
115    
116    
117            while (my $row = $sth->fetchrow_hashref()) {
118    
119                    # create a document object
120                    my $doc = HyperEstraier::Document->new;
121    
122                    # add attributes to the document object
123                    $doc->add_attr('@uri', 'file:///' . $row->{'fid'});
124    
125                    foreach my $c (qw/fid hname sname sharename backupNum filename filepath shareid/) {
126                            $doc->add_attr($c, $row->{$c}) if ($row->{$c});
127                    }
128    
129                    $doc->add_attr('date', fmt_date($row->{'date'}));
130    
131                    # add the body text to the document object
132                    my $path = $row->{'filepath'};
133                    $doc->add_text($path);
134                    $path =~ s/(.)/$1 /g;
135                    $doc->add_hidden_text($path);
136    
137                    print STDERR $doc->dump_draft,"\n" if ($debug > 1);
138    
139                    # register the document object to the database
140                    $db->put_doc($doc, $HyperEstraier::Database::PDCLEAN);
141    
142                    $i++;
143                    if ($i % $dot == 0) {
144                            print "$max ";
145                            $max--;
146                    }
147    
148            }
149    
150            print "sync";
151            $db->sync();
152            print " close\n";
153            $db->close();
154    
155            exit;
156    }
157    
158  ###################################create tables############################3  ###################################create tables############################3
159    
160  if ($opt{c}) {  if ($opt{c}) {
161            sub do_index {
162                    my $index = shift || return;
163                    my ($table,$col,$unique) = split(/_/, $index);
164                    $unique ||= '';
165                    $index =~ s/,/_/g;
166                    $dbh->do(qq{ create $unique index $index on $table($col) });
167            }
168    
169          print "creating tables...\n";          print "creating tables...\n";
170                
171          $dbh->do(qq{          $dbh->do(qq{
172                  create table hosts (                  create table hosts (
173                          ID      INTEGER         PRIMARY KEY,                          ID      SERIAL          PRIMARY KEY,
174                          name    VARCHAR(30)     NOT NULL,                          name    VARCHAR(30)     NOT NULL,
175                          IP      VARCHAR(15)                          IP      VARCHAR(15)
176                  );                              );            
# Line 67  if ($opt{c}) { Line 178  if ($opt{c}) {
178                                
179          $dbh->do(qq{          $dbh->do(qq{
180                  create table shares (                  create table shares (
181                          ID      INTEGER         PRIMARY KEY,                          ID      SERIAL          PRIMARY KEY,
182                          hostID  INTEGER         NOT NULL references hosts(id),                          hostID  INTEGER         NOT NULL references hosts(id),
183                          name    VARCHAR(30)     NOT NULL,                          name    VARCHAR(30)     NOT NULL,
184                          share   VARCHAR(200)    NOT NULL,                          share   VARCHAR(200)    NOT NULL,
# Line 79  if ($opt{c}) { Line 190  if ($opt{c}) {
190                  create table backups (                  create table backups (
191                          hostID  INTEGER         NOT NULL references hosts(id),                          hostID  INTEGER         NOT NULL references hosts(id),
192                          num     INTEGER         NOT NULL,                          num     INTEGER         NOT NULL,
193                          date    DATE,                          date    integer         NOT NULL,
194                          type    CHAR(1),                          type    CHAR(4)         not null,
195                          PRIMARY KEY(hostID, num)                          shareID integer         not null references shares(id),
196                            size    integer         not null,
197                            PRIMARY KEY(hostID, num, shareID)
198                  );                              );            
199          });          });
200    
201            #do_index('backups_hostid,num_unique');
202    
203          $dbh->do(qq{          $dbh->do(qq{
204                  create table dvds (                  create table dvds (
205                          ID      INTEGER         PRIMARY KEY,                          ID      SERIAL          PRIMARY KEY,
206                          num     INTEGER         NOT NULL,                          num     INTEGER         NOT NULL,
207                          name    VARCHAR(255)    NOT NULL,                          name    VARCHAR(255)    NOT NULL,
208                          mjesto  VARCHAR(255)                          mjesto  VARCHAR(255)
# Line 96  if ($opt{c}) { Line 211  if ($opt{c}) {
211    
212          $dbh->do(qq{              $dbh->do(qq{    
213                  create table files (                  create table files (
214                          ID      INTEGER         NOT NULL PRIMARY KEY,                            ID      SERIAL          PRIMARY KEY,  
215                          shareID INTEGER         NOT NULL references shares(id),                          shareID INTEGER         NOT NULL references shares(id),
216                          backupNum  INTEGER      NOT NULL references backups(num),                          backupNum  INTEGER      NOT NULL,
217                          name       VARCHAR(255) NOT NULL,                          name       VARCHAR(255) NOT NULL,
218                          path       VARCHAR(255) NOT NULL,                          path       VARCHAR(255) NOT NULL,
219                          fullpath   VARCHAR(255) NOT NULL,                          date       integer      NOT NULL,
                         date       TIMESTAMP    NOT NULL,  
220                          type       INTEGER      NOT NULL,                          type       INTEGER      NOT NULL,
221                          size       INTEGER      NOT NULL,                          size       INTEGER      NOT NULL,
222                          dvdid      INTEGER      references dvds(id)                              dvdid      INTEGER      references dvds(id)    
223                  );                  );
224          });          });
225    
226          print "creating indexes...\n";          print "creating indexes:";
227    
228          foreach my $index (qw(          foreach my $index (qw(
229                  hosts_name                  hosts_name
# Line 123  if ($opt{c}) { Line 237  if ($opt{c}) {
237                  files_date                  files_date
238                  files_size                  files_size
239          )) {          )) {
240                  my ($table,$col) = split(/_/, $index);                  print " $index";
241                  $dbh->do(qq{ create index $index on $table($col) });                  do_index($index);
242          }          }
243            print "...\n";
244    
245            $dbh->commit;
246    
247  }  }
248    
249  if ($opt{d}) {  if ($opt{d}) {
250          print "deleting ";          print "deleting ";
251          foreach my $table (qw(hosts shares files dvds backups)) {          foreach my $table (qw(files dvds backups shares hosts)) {
252                  print "$table ";                  print "$table ";
253                  $dbh->do(qq{ DELETE FROM $table });                  $dbh->do(qq{ DELETE FROM $table });
254          }          }
255          print " done...\n";          print " done...\n";
 }  
256    
257  if ($opt{v}) {          $dbh->commit;
         print "Debug level at $opt{v}\n";  
         $debug = $opt{v};  
258  }  }
259    
260  #################################INSERT VALUES#############################  #################################INSERT VALUES#############################
# Line 161  $sth->{hosts_by_name} = $dbh->prepare(qq Line 274  $sth->{hosts_by_name} = $dbh->prepare(qq
274  SELECT ID FROM hosts WHERE name=?  SELECT ID FROM hosts WHERE name=?
275  });  });
276    
277  $sth->{backups_broj} = $dbh->prepare(qq{  $sth->{backups_count} = $dbh->prepare(qq{
278  SELECT COUNT(*)  SELECT COUNT(*)
279  FROM backups  FROM backups
280  WHERE hostID=? AND num=?  WHERE hostID=? AND num=? AND shareid=?
281  });  });
282    
283  $sth->{insert_backups} = $dbh->prepare(qq{  $sth->{insert_backups} = $dbh->prepare(qq{
284  INSERT INTO backups (hostID, num, date, type)  INSERT INTO backups (hostID, num, date, type, shareid, size)
285  VALUES (?,?,?,?)  VALUES (?,?,?,?,?,?)
286  });  });
287    
288  $sth->{insert_files} = $dbh->prepare(qq{  $sth->{insert_files} = $dbh->prepare(qq{
289  INSERT INTO files  INSERT INTO files
290          (shareID, backupNum, name, path, fullpath, date, type, size)          (shareID, backupNum, name, path, date, type, size)
291          VALUES (?,?,?,?,?,?,?,?)          VALUES (?,?,?,?,?,?,?)
292  });  });
293    
294    sub fmt_time {
295            my $t = shift || return;
296            my $out = "";
297            my ($ss,$mm,$hh) = gmtime($t);
298            $out .= "${hh}h" if ($hh);
299            $out .= sprintf("%02d:%02d", $mm,$ss);
300            return $out;
301    }
302    
303  foreach my $host_key (keys %{$hosts}) {  foreach my $host_key (keys %{$hosts}) {
304    
305          my $hostname = $hosts->{$host_key}->{'host'} || die "can't find host for $host_key";          my $hostname = $hosts->{$host_key}->{'host'} || die "can't find host for $host_key";
# Line 190  foreach my $host_key (keys %{$hosts}) { Line 312  foreach my $host_key (keys %{$hosts}) {
312                          $hosts->{$host_key}->{'ip'}                          $hosts->{$host_key}->{'ip'}
313                  );                  );
314    
315                  $hostID = $dbh->func('last_insert_rowid');                  $hostID = $dbh->last_insert_id(undef,undef,'hosts',undef);
316          }          }
317    
318          print("host ".$hosts->{$host_key}->{'host'}.": ");          print "host ".$hosts->{$host_key}->{'host'}.": ";
319    
320          # get backups for a host          # get backups for a host
321          my @backups = $bpc->BackupInfoRead($hostname);          my @backups = $bpc->BackupInfoRead($hostname);
322          print scalar @backups, " increments\n";          my $incs = scalar @backups;
323            print  "$incs increments\n";
324    
325          my $inc_nr = 0;          my $inc_nr = 0;
326            $beenThere = {};
327    
328          foreach my $backup (@backups) {          foreach my $backup (@backups) {
329    
330                  $inc_nr++;                  $inc_nr++;
331                  last if ($opt{m} && $inc_nr > $opt{m});                  last if ($opt{m} && $inc_nr > $opt{m});
332    
333                  my $backupNum = $backup->{'num'};                  my $backupNum = $backup->{'num'};
334                  my @backupShares = ();                  my @backupShares = ();
335    
336                  print $hosts->{$host_key}->{'host'}, "\t#$backupNum\n";                  printf("%-10s %2d/%-2d #%-2d %s %5s/%5s files (date: %s dur: %s)\n",
337                            $hosts->{$host_key}->{'host'},
338                  $sth->{backups_broj}->execute($hostID, $backupNum);                          $inc_nr, $incs, $backupNum,
339                  my ($broj) = $sth->{backups_broj}->fetchrow_array();                          $backup->{type} || '?',
340                  next if ($broj > 0);                          $backup->{nFilesNew} || '?', $backup->{nFiles} || '?',
341                            strftime($t_fmt,localtime($backup->{startTime})),
342                            fmt_time($backup->{endTime} - $backup->{startTime})
343                    );
344    
345                  my $files = BackupPC::View->new($bpc, $hostname, \@backups, 1);                  my $files = BackupPC::View->new($bpc, $hostname, \@backups, 1);
346                  foreach my $share ($files->shareList($backupNum)) {                  foreach my $share ($files->shareList($backupNum)) {
347    
348                          my $t = time();                          my $t = time();
349    
                         print strftime($t_fmt,localtime())," ", $share;  
350                          $shareID = getShareID($share, $hostID, $hostname);                          $shareID = getShareID($share, $hostID, $hostname);
351                                    
352                          my ($f, $nf, $d, $nd) = recurseDir($bpc, $hostname, $files, $backupNum, $share, "", $shareID);                          $sth->{backups_count}->execute($hostID, $backupNum, $shareID);
353                          printf(" %d/%d files %d/%d dirs [%.2f/s]\n",                          my ($count) = $sth->{backups_count}->fetchrow_array();
354                                  $nf, $f, $nd, $d,                          # skip if allready in database!
355                                  ( ($f+$d) / ((time() - $t) || 1) )                          next if ($count > 0);
356    
357                            # dump some log
358                            print strftime($t_fmt,localtime())," ", $share;
359    
360                            my ($f, $nf, $d, $nd, $size) = recurseDir($bpc, $hostname, $files, $backupNum, $share, "", $shareID);
361    
362                            $sth->{insert_backups}->execute(
363                                    $hostID,
364                                    $backupNum,
365                                    $backup->{'endTime'},
366                                    $backup->{'type'},
367                                    $shareID,
368                                    $size,
369                          );                          );
370    
371                            print " commit";
372                          $dbh->commit();                          $dbh->commit();
                 }  
373    
374                  $sth->{insert_backups}->execute(                          my $dur = (time() - $t) || 1;
375                          $hostID,                          printf(" %d/%d files %d/%d dirs %0.2f MB [%.2f/s dur: %s]\n",
376                          $backupNum,                                  $nf, $f, $nd, $d,
377                          $backup->{'endTime'},                                  ($size / 1024 / 1024),
378                          $backup->{'type'}                                  ( ($f+$d) / $dur ),
379                  );                                  fmt_time($dur)
380                  $dbh->commit();                          );
381                    }
382    
383          }          }
384  }  }
# Line 244  undef $sth; Line 386  undef $sth;
386  $dbh->commit();  $dbh->commit();
387  $dbh->disconnect();  $dbh->disconnect();
388    
389    print "total duration: ",fmt_time(time() - $start_t),"\n";
390    
391  $pidfile->remove;  $pidfile->remove;
392    
393  sub getShareID() {  sub getShareID() {
# Line 270  sub getShareID() { Line 414  sub getShareID() {
414          $drop_down =~ s#//+#/#g;          $drop_down =~ s#//+#/#g;
415    
416          $sth->{insert_share}->execute($hostID,$share, $drop_down ,undef);          $sth->{insert_share}->execute($hostID,$share, $drop_down ,undef);
417          return $dbh->func('last_insert_rowid');                  return $dbh->last_insert_id(undef,undef,'shares',undef);
418  }  }
419    
420  sub found_in_db {  sub found_in_db {
421    
422          my ($shareID,undef,$name,$path,undef,$date,undef,$size) = @_;          my @data = @_;
423            shift @data;
424    
425            my ($key, $shareID,undef,$name,$path,$date,undef,$size) = @_;
426    
427            return $beenThere->{$key} if (defined($beenThere->{$key}));
428    
429          $sth->{file_in_db} ||= $dbh->prepare(qq{          $sth->{file_in_db} ||= $dbh->prepare(qq{
430                  SELECT count(*) FROM files                  SELECT 1 FROM files
431                  WHERE shareID = ? and                  WHERE shareID = ? and
432                          path = ? and                          path = ? and
                         name = ? and  
433                          date = ? and                          date = ? and
434                          size = ?                          size = ?
435                    LIMIT 1
436          });          });
437    
438          my @param = ($shareID,$path,$name,$date,$size);          my @param = ($shareID,$path,$date,$size);
439          $sth->{file_in_db}->execute(@param);          $sth->{file_in_db}->execute(@param);
440          my ($rows) = $sth->{file_in_db}->fetchrow_array();          my $rows = $sth->{file_in_db}->rows;
441  #       print STDERR ( $rows ? '+' : '-' ), join(" ",@param), "\n";          print STDERR "## found_in_db($shareID,$path,$date,$size) ",( $rows ? '+' : '-' ), join(" ",@param), "\n" if ($debug >= 3);
442    
443            $beenThere->{$key}++;
444    
445            $sth->{'insert_files'}->execute(@data) unless ($rows);
446          return $rows;          return $rows;
447  }  }
448    
# Line 301  sub recurseDir($$$$$$$$) { Line 454  sub recurseDir($$$$$$$$) {
454    
455          my ($bpc, $hostname, $files, $backupNum, $share, $dir, $shareID) = @_;          my ($bpc, $hostname, $files, $backupNum, $share, $dir, $shareID) = @_;
456    
457          print STDERR "recurse($hostname,$backupNum,$share,$dir,$shareID)\n" if ($debug >= 1);          print STDERR "\nrecurse($hostname,$backupNum,$share,$dir,$shareID)\n" if ($debug >= 1);
458    
459          my ($nr_files, $new_files, $nr_dirs, $new_dirs) = (0,0,0,0);          my ($nr_files, $new_files, $nr_dirs, $new_dirs, $size) = (0,0,0,0,0);
460    
461          { # scope          { # scope
462                  my @stack;                  my @stack;
463    
464                    print STDERR "# dirAttrib($backupNum, $share, $dir)\n" if ($debug >= 2);
465                  my $filesInBackup = $files->dirAttrib($backupNum, $share, $dir);                  my $filesInBackup = $files->dirAttrib($backupNum, $share, $dir);
466    
467                  # first, add all the entries in current directory                  # first, add all the entries in current directory
468                  foreach my $path_key (keys %{$filesInBackup}) {                  foreach my $path_key (keys %{$filesInBackup}) {
469                            print STDERR "# file ",Dumper($filesInBackup->{$path_key}),"\n" if ($debug >= 3);
470                          my @data = (                          my @data = (
471                                  $shareID,                                  $shareID,
472                                  $backupNum,                                  $backupNum,
473                                  $path_key,                                  $path_key,
474                                  $filesInBackup->{$path_key}->{'relPath'},                                  $filesInBackup->{$path_key}->{'relPath'},
                                 $filesInBackup->{$path_key}->{'fullPath'},  
         #                       $filesInBackup->{$path_key}->{'sharePathM'},  
475                                  $filesInBackup->{$path_key}->{'mtime'},                                  $filesInBackup->{$path_key}->{'mtime'},
476                                  $filesInBackup->{$path_key}->{'type'},                                  $filesInBackup->{$path_key}->{'type'},
477                                  $filesInBackup->{$path_key}->{'size'}                                  $filesInBackup->{$path_key}->{'size'}
# Line 332  sub recurseDir($$$$$$$$) { Line 485  sub recurseDir($$$$$$$$) {
485                                  $filesInBackup->{$path_key}->{'size'}                                  $filesInBackup->{$path_key}->{'size'}
486                          ));                          ));
487    
488                            my $found;
489                          if (! $beenThere->{$key} && ! found_in_db(@data)) {                          if (! defined($beenThere->{$key}) && ! ($found = found_in_db($key, @data)) ) {
490                                  print STDERR "# key: $key [", $beenThere->{$key},"]" if ($debug >= 2);                                  print STDERR "# key: $key [", $beenThere->{$key},"]" if ($debug >= 2);
491                                  $sth->{'insert_files'}->execute(@data);  
492                                  if ($filesInBackup->{$path_key}->{'type'} == BPC_FTYPE_DIR) {                                  if ($filesInBackup->{$path_key}->{'type'} == BPC_FTYPE_DIR) {
493                                          $new_dirs++;                                          $new_dirs++ unless ($found);
494                                          print STDERR " dir\n" if ($debug >= 2);                                          print STDERR " dir\n" if ($debug >= 2);
495                                  } else {                                  } else {
496                                          $new_files++;                                          $new_files++ unless ($found);
497                                          print STDERR " file\n" if ($debug >= 2);                                          print STDERR " file\n" if ($debug >= 2);
498                                  }                                  }
499                                    $size += $filesInBackup->{$path_key}->{'size'} || 0;
500                          }                          }
                         $beenThere->{$key}++;  
501    
502                          if ($filesInBackup->{$path_key}->{'type'} == BPC_FTYPE_DIR) {                          if ($filesInBackup->{$path_key}->{'type'} == BPC_FTYPE_DIR) {
503                                  $nr_dirs++;                                  $nr_dirs++;
# Line 368  sub recurseDir($$$$$$$$) { Line 521  sub recurseDir($$$$$$$$) {
521                  print STDERR "## STACK ",join(", ", @stack),"\n" if ($debug >= 2);                  print STDERR "## STACK ",join(", ", @stack),"\n" if ($debug >= 2);
522    
523                  while ( my $dir = shift @stack ) {                  while ( my $dir = shift @stack ) {
524                          my ($f,$nf,$d,$nd) = recurseDir($bpc, $hostname, $files, $backupNum, $share, $dir, $shareID);                          my ($f,$nf,$d,$nd, $s) = recurseDir($bpc, $hostname, $files, $backupNum, $share, $dir, $shareID);
525                          print STDERR "# $dir f: $f nf: $nf d: $d nd: $nd\n" if ($debug >= 1);                          print STDERR "# $dir f: $f nf: $nf d: $d nd: $nd\n" if ($debug >= 1);
526                          $nr_files += $f;                          $nr_files += $f;
527                          $new_files += $nf;                          $new_files += $nf;
528                          $nr_dirs += $d;                          $nr_dirs += $d;
529                          $new_dirs += $nd;                          $new_dirs += $nd;
530                            $size += $s;
531                  }                  }
532          }          }
533    
534          return ($nr_files, $new_files, $nr_dirs, $new_dirs);          return ($nr_files, $new_files, $nr_dirs, $new_dirs, $size);
535  }  }
536    

Legend:
Removed from v.38  
changed lines
  Added in v.82

  ViewVC Help
Powered by ViewVC 1.1.26