/[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 241 by dpavlin, Thu Nov 17 17:56:25 2005 UTC revision 242 by dpavlin, Fri Nov 18 19:40:47 2005 UTC
# Line 434  WHERE hostID=? AND num=? AND shareid=? Line 434  WHERE hostID=? AND num=? AND shareid=?
434    
435  $sth->{insert_backups} = $dbh->prepare(qq{  $sth->{insert_backups} = $dbh->prepare(qq{
436  INSERT INTO backups (hostID, num, date, type, shareid, size)  INSERT INTO backups (hostID, num, date, type, shareid, size)
437  VALUES (?,?,?,?,?,?)  VALUES (?,?,?,?,?,-1)
438    });
439    
440    $sth->{update_backups_size} = $dbh->prepare(qq{
441    UPDATE backups SET size = ?
442    WHERE hostID = ? and num = ? and date = ? and type =? and shareid = ?
443  });  });
444    
445  $sth->{insert_files} = $dbh->prepare(qq{  $sth->{insert_files} = $dbh->prepare(qq{
# Line 500  foreach my $host_key (keys %{$hosts}) { Line 505  foreach my $host_key (keys %{$hosts}) {
505                          # dump some log                          # dump some log
506                          print curr_time," ", $share;                          print curr_time," ", $share;
507    
                         my ($f, $nf, $d, $nd, $size) = recurseDir($bpc, $hostname, $files, $backupNum, $share, "", $shareID);  
   
508                          $sth->{insert_backups}->execute(                          $sth->{insert_backups}->execute(
509                                  $hostID,                                  $hostID,
510                                  $backupNum,                                  $backupNum,
511                                  $backup->{'endTime'},                                  $backup->{'endTime'},
512                                  substr($backup->{'type'},0,4),                                  substr($backup->{'type'},0,4),
513                                  $shareID,                                  $shareID,
514                            );
515    
516                            my ($f, $nf, $d, $nd, $size) = recurseDir($bpc, $hostname, $files, $backupNum, $share, "", $shareID);
517    
518                            $sth->{update_backups_size}->execute(
519                                  $size,                                  $size,
520                                    $hostID,
521                                    $backupNum,
522                                    $backup->{'endTime'},
523                                    substr($backup->{'type'},0,4),
524                                    $shareID,
525                          );                          );
526    
527                          print " commit";                          print " commit";
# Line 633  sub recurseDir($$$$$$$$) { Line 646  sub recurseDir($$$$$$$$) {
646                          # daylight saving time change offset for 1h                          # daylight saving time change offset for 1h
647                          my $dst_offset = 60 * 60;                          my $dst_offset = 60 * 60;
648    
649                          my $key_dst1 = join(" ", (                          my $key_dst_prev = join(" ", (
650                                  $shareID,                                  $shareID,
651                                  $dir,                                  $dir,
652                                  $path_key,                                  $path_key,
# Line 641  sub recurseDir($$$$$$$$) { Line 654  sub recurseDir($$$$$$$$) {
654                                  $filesInBackup->{$path_key}->{'size'}                                  $filesInBackup->{$path_key}->{'size'}
655                          ));                          ));
656    
657                          my $key_dst2 = join(" ", (                          my $key_dst_next = join(" ", (
658                                  $shareID,                                  $shareID,
659                                  $dir,                                  $dir,
660                                  $path_key,                                  $path_key,
# Line 652  sub recurseDir($$$$$$$$) { Line 665  sub recurseDir($$$$$$$$) {
665                          my $found;                          my $found;
666                          if (                          if (
667                                  ! defined($beenThere->{$key}) &&                                  ! defined($beenThere->{$key}) &&
668                                  ! defined($beenThere->{$key_dst1}) &&                                  ! defined($beenThere->{$key_dst_prev}) &&
669                                  ! defined($beenThere->{$key_dst2}) &&                                  ! defined($beenThere->{$key_dst_next}) &&
670                                  ! ($found = found_in_db($key, @data))                                  ! ($found = found_in_db($key, @data))
671                          ) {                          ) {
672                                  print STDERR "# key: $key [", $beenThere->{$key},"]" if ($debug >= 2);                                  print STDERR "# key: $key [", $beenThere->{$key},"]" if ($debug >= 2);

Legend:
Removed from v.241  
changed lines
  Added in v.242

  ViewVC Help
Powered by ViewVC 1.1.26