/[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 89 by dpavlin, Sun Aug 28 17:04:12 2005 UTC revision 95 by dpavlin, Tue Aug 30 09:55:34 2005 UTC
# Line 89  sub hest_update { Line 89  sub hest_update {
89    
90          my ($host_id, $share_id, $num) = @_;          my ($host_id, $share_id, $num) = @_;
91    
92          print curr_time," updating HyperEstraier: files";          print curr_time," updating HyperEstraier: select files";
93    
94          my $t = time();          my $t = time();
95    
# Line 113  sub hest_update { Line 113  sub hest_update {
113                          -- files.name                   AS filename,                          -- files.name                   AS filename,
114                          files.path                      AS filepath,                          files.path                      AS filepath,
115                          files.date                      AS date,                          files.date                      AS date,
116                          files.type                      AS filetype,                          files.type                      AS type,
117                          files.size                      AS size,                          files.size                      AS size,
118                          files.shareid                   AS shareid,                          files.shareid                   AS shareid,
119                          backups.date                    AS backup_date                          backups.date                    AS backup_date
# Line 128  sub hest_update { Line 128  sub hest_update {
128          my $results = $sth->rows;          my $results = $sth->rows;
129    
130          if ($results == 0) {          if ($results == 0) {
131                  print " no files\n";                  print " - no files, skipping\n";
132                  return;                  return;
133          }          }
134    
# Line 145  sub hest_update { Line 145  sub hest_update {
145    
146          my $max = int($results / $dot);          my $max = int($results / $dot);
147    
148          print " index $index_path...";          print ", opening index $index_path...";
149          use HyperEstraier;          use HyperEstraier;
150          my $db = HyperEstraier::Database->new();          my $db = HyperEstraier::Database->new();
151    
# Line 165  sub hest_update { Line 165  sub hest_update {
165                  my $fid = $row->{'fid'} || die "no fid?";                  my $fid = $row->{'fid'} || die "no fid?";
166                  my $uri = 'file:///' . $fid;                  my $uri = 'file:///' . $fid;
167    
168                  next if ($db->uri_to_id($uri));                  my $id = $db->uri_to_id($uri);
169                    next unless ($id == -1);
170    
171                  # create a document object                  # create a document object
172                  my $doc = HyperEstraier::Document->new;                  my $doc = HyperEstraier::Document->new;
# Line 200  sub hest_update { Line 201  sub hest_update {
201    
202          print "sync $added new files";          print "sync $added new files";
203          $db->sync();          $db->sync();
204          print " close";          print ", close";
205          $db->close();          $db->close();
206    
207          my $dur = (time() - $t) || 1;          my $dur = (time() - $t) || 1;
# Line 215  sub hest_update { Line 216  sub hest_update {
216    
217    
218  ## update index ##  ## update index ##
219  if ($opt{i} || ($index_path && ! -e $index_path)) {  if (($opt{i} || ($index_path && ! -e $index_path)) && !$opt{c}) {
220          # update all          # update all
221          print "force update of HyperEstraier index ";          print "force update of HyperEstraier index ";
222          print "importing existing data" unless (-e $index_path);          print "importing existing data" unless (-e $index_path);

Legend:
Removed from v.89  
changed lines
  Added in v.95

  ViewVC Help
Powered by ViewVC 1.1.26