/[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 25 by dpavlin, Wed Jul 13 09:57:41 2005 UTC revision 27 by dpavlin, Fri Jul 29 17:31:14 2005 UTC
# Line 273  sub recurseDir($$$$$$$$) { Line 273  sub recurseDir($$$$$$$$) {
273    
274          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);
275    
276          my $files = BackupPC::View->new($bpc, $hostname, $backups);                      my @stack;
277          my $filesInBackup = $files->dirAttrib($backupNum, $share, $dir);  
278            { # scope
279    
280                    my $files = BackupPC::View->new($bpc, $hostname, $backups);            
281                    my $filesInBackup = $files->dirAttrib($backupNum, $share, $dir);
282    
283    print STDERR "$hostname: $share | $dir | $backupNum\n";
284    
285                    # first, add all the entries in current directory
286                    foreach my $path_key (keys %{$filesInBackup}) {
287                            my @data = (
288                                    $shareID,
289                                    $backupNum,
290                                    $path_key,
291                                    $filesInBackup->{$path_key}->{'relPath'},
292                                    $filesInBackup->{$path_key}->{'fullPath'},
293            #                       $filesInBackup->{$path_key}->{'sharePathM'},
294                                    $filesInBackup->{$path_key}->{'mtime'},
295                                    $filesInBackup->{$path_key}->{'type'},
296                                    $filesInBackup->{$path_key}->{'size'}
297                            );
298    
299                            my $key = join(" ", (
300                                    $shareID,
301                                    $dir,
302                                    $path_key,
303                                    $filesInBackup->{$path_key}->{'mtime'},
304                                    $filesInBackup->{$path_key}->{'size'}
305                            ));
306    
307    
308                            if (! $beenThere->{$key} && ! found_in_db(@data)) {
309                                    $sth->{'insert_files'}->execute(@data);
310                                    print STDERR "$key\n";
311                                    if ($filesInBackup->{$path_key}->{'type'} == BPC_FTYPE_DIR) {
312                                            $new_dirs++;
313                                    } else {
314                                            $new_files++;
315                                    }
316                            }
317                            $beenThere->{$key}++;
318    
         # first, add all the entries in current directory  
         foreach my $path_key (keys %{$filesInBackup}) {  
                 my @data = (  
                         $shareID,  
                         $backupNum,  
                         $path_key,  
                         $filesInBackup->{$path_key}->{'relPath'},  
                         $filesInBackup->{$path_key}->{'fullPath'},  
 #                       $filesInBackup->{$path_key}->{'sharePathM'},  
                         $filesInBackup->{$path_key}->{'mtime'},  
                         $filesInBackup->{$path_key}->{'type'},  
                         $filesInBackup->{$path_key}->{'size'}  
                 );  
   
                 my $key = join(" ", (  
                         $shareID,  
                         $dir,  
                         $path_key,  
                         $filesInBackup->{$path_key}->{'mtime'},  
                         $filesInBackup->{$path_key}->{'size'}  
                 ));  
   
   
                 if (! $beenThere->{$key} && ! found_in_db(@data)) {  
                         $sth->{'insert_files'}->execute(@data);  
 #                       print STDERR "$key\n";  
319                          if ($filesInBackup->{$path_key}->{'type'} == BPC_FTYPE_DIR) {                          if ($filesInBackup->{$path_key}->{'type'} == BPC_FTYPE_DIR) {
320                                  $new_dirs++;                                  $nr_dirs++;
321    
322                                    push @stack, [ $bpc, $hostname, $backups, $backupNum, $share, $path_key, $shareID ] unless ($beenThere->{$key});
323    #                               my ($f,$nf,$d,$nd) = recurseDir($bpc, $hostname, $backups, $backupNum, $share, $path_key, $shareID) unless ($beenThere->{$key});
324    #
325    #                               $nr_files += $f;
326    #                               $new_files += $nf;
327    #                               $nr_dirs += $d;
328    #                               $new_dirs += $nd;
329    
330                          } else {                          } else {
331                                  $new_files++;                                  $nr_files++;
332                          }                          }
333                  }                  }
                 $beenThere->{$key}++;  
   
                 if ($filesInBackup->{$path_key}->{'type'} == BPC_FTYPE_DIR) {  
                         $nr_dirs++;  
   
                         my ($f,$nf,$d,$nd) = recurseDir($bpc, $hostname, $backups, $backupNum, $share, $path_key, $shareID);  
334    
335                          $nr_files += $f;          }
                         $new_files += $nf;  
                         $nr_dirs += $d;  
                         $new_dirs += $nd;  
336    
337                  } else {          foreach my $r (@stack) {
338                          $nr_files++;                  my ($f,$nf,$d,$nd) = recurseDir(@{$r});
339                  }                  $nr_files += $f;
340                    $new_files += $nf;
341                    $nr_dirs += $d;
342                    $new_dirs += $nd;
343          }          }
344    
345          return ($nr_files, $new_files, $nr_dirs, $new_dirs);          return ($nr_files, $new_files, $nr_dirs, $new_dirs);

Legend:
Removed from v.25  
changed lines
  Added in v.27

  ViewVC Help
Powered by ViewVC 1.1.26