/[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 242 by dpavlin, Fri Nov 18 19:40:47 2005 UTC revision 246 by dpavlin, Fri Dec 9 12:49:55 2005 UTC
# Line 16  use BackupPC::SearchLib; Line 16  use BackupPC::SearchLib;
16  use constant BPC_FTYPE_DIR => 5;  use constant BPC_FTYPE_DIR => 5;
17  use constant EST_CHUNK => 100000;  use constant EST_CHUNK => 100000;
18    
19    # daylight saving time change offset for 1h
20    my $dst_offset = 60 * 60;
21    
22  my $debug = 0;  my $debug = 0;
23  $|=1;  $|=1;
24    
# Line 50  my $dbh = DBI->connect($dsn, $user, "", Line 53  my $dbh = DBI->connect($dsn, $user, "",
53    
54  my %opt;  my %opt;
55    
56  if ( !getopts("cdm:v:ij", \%opt ) ) {  if ( !getopts("cdm:v:ijf", \%opt ) ) {
57          print STDERR <<EOF;          print STDERR <<EOF;
58  usage: $0 [-c|-d] [-m num] [-v|-v level] [-i]  usage: $0 [-c|-d] [-m num] [-v|-v level] [-i|-j|-f]
59    
60  Options:  Options:
61          -c      create database on first use          -c      create database on first use
# Line 61  Options: Line 64  Options:
64          -v num  set verbosity (debug) level (default $debug)          -v num  set verbosity (debug) level (default $debug)
65          -i      update Hyper Estraier full text index          -i      update Hyper Estraier full text index
66          -j      update full text, don't check existing files          -j      update full text, don't check existing files
67            -f      don't do anything with full text index
68    
69  Option -j is variation on -i. It will allow faster initial creation  Option -j is variation on -i. It will allow faster initial creation
70  of full-text index from existing database.  of full-text index from existing database.
71    
72    Option -f will create database which is out of sync with full text index. You
73    will have to re-run $0 with -i to fix it.
74    
75  EOF  EOF
76          exit 1;          exit 1;
77  }  }
# Line 72  EOF Line 79  EOF
79  if ($opt{v}) {  if ($opt{v}) {
80          print "Debug level at $opt{v}\n";          print "Debug level at $opt{v}\n";
81          $debug = $opt{v};          $debug = $opt{v};
82    } elsif ($opt{f}) {
83            print "WARNING: disabling full-text index update. You need to re-run $0 -j !\n";
84            ($use_hest, $index_path, $index_node_url) = (undef, undef, undef);
85  }  }
86    
87  #---- subs ----  #---- subs ----
# Line 588  sub found_in_db { Line 598  sub found_in_db {
598                  SELECT 1 FROM files                  SELECT 1 FROM files
599                  WHERE shareID = ? and                  WHERE shareID = ? and
600                          path = ? and                          path = ? and
601                          date = ? and                          size = ? and
602                          size = ?                          ( date = ? or date = ? or date = ? )
603                  LIMIT 1                  LIMIT 1
604          });          });
605    
606          my @param = ($shareID,$path,$date,$size);          my @param = ($shareID,$path,$size,$date, $date-$dst_offset, $date+$dst_offset);
607          $sth->{file_in_db}->execute(@param);          $sth->{file_in_db}->execute(@param);
608          my $rows = $sth->{file_in_db}->rows;          my $rows = $sth->{file_in_db}->rows;
609          print STDERR "## found_in_db($shareID,$path,$date,$size) ",( $rows ? '+' : '-' ), join(" ",@param), "\n" if ($debug >= 3);          print STDERR "## found_in_db($shareID,$path,$date,$size) ",( $rows ? '+' : '-' ), join(" ",@param), "\n" if ($debug >= 3);
# Line 643  sub recurseDir($$$$$$$$) { Line 653  sub recurseDir($$$$$$$$) {
653                                  $filesInBackup->{$path_key}->{'size'}                                  $filesInBackup->{$path_key}->{'size'}
654                          ));                          ));
655    
                         # daylight saving time change offset for 1h  
                         my $dst_offset = 60 * 60;  
   
656                          my $key_dst_prev = join(" ", (                          my $key_dst_prev = join(" ", (
657                                  $shareID,                                  $shareID,
658                                  $dir,                                  $dir,

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

  ViewVC Help
Powered by ViewVC 1.1.26