Show
Ignore:
Timestamp:
01.02.2009 14:36:22 (11 years ago)
Author:
davidb
Message:

Modifications for incremental building to support files that need to be deleted

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/plugins/ArchivesInfPlugin.pm

    r17738 r18441  
    2424########################################################################### 
    2525 
    26 # plugin which reads through an archives.inf file 
    27 # (i.e. the file generated in the archives directory 
    28 # when an import is done), processing each file it finds  
     26# plugin which reads through an archives.inf (or GDBM equivalent, 
     27# archiveinf-doc.{ldb,bdb} file (i.e. the file generated in the 
     28# archives directory when an import is done), processing each file it 
     29# finds 
    2930 
    3031package ArchivesInfPlugin; 
     
    8687    my ($self) = @_; 
    8788 
     89    print STDERR "*** Running ArchivesInf deinit\n"; 
     90 
    8891    my $archive_info = $self->{'archive_info'}; 
    8992 
     
    9396        my $file_list = $archive_info->get_file_list(); 
    9497 
    95     # change each file to "Been Indexed" 
    96  
    9798    foreach my $subfile (@$file_list) { 
    9899        my $doc_oid = $subfile->[1]; 
    99         # why do we get this when it is not used??? 
     100 
    100101        my $index_status = $archive_info->get_status_info($doc_oid); 
    101         $archive_info->set_status_info($doc_oid,"B"); 
     102        if ($index_status eq "D") { 
     103        # delete 
     104        $archive_info->delete_info($doc_oid); 
     105        } 
     106        elsif ($index_status =~ m/^(I|R)$/) { 
     107        # mark as "been indexed" 
     108        $archive_info->set_status_info($doc_oid,"B"); 
     109        } 
    102110    } 
    103111 
     
    169177 
    170178    # see if this has a archives information file within it 
    171     my $archive_info_filename = &util::filename_cat($base_dir,$file,"archives.inf"); 
     179##    my $archive_info_filename = &util::filename_cat($base_dir,$file,"archives.inf"); 
     180    my $db_ext = &util::is_little_endian() ? ".ldb" : ".bdb"; 
     181    my $doc_db = "archiveinf-doc$db_ext"; 
     182    my $archive_info_filename = &util::filename_cat($base_dir,$file,$doc_db); 
    172183 
    173184    if (-e $archive_info_filename) { 
     
    187198    # process each file 
    188199    foreach my $subfile (@$file_list) { 
     200 
    189201        last if ($maxdocs != -1 && ($total_count + $count) >= $maxdocs); 
    190202 
     
    198210        if ($processor->is_incremental_capable() && $self->{'incremental'}) 
    199211        { 
    200             # We don't need to process the file if it has already been built 
     212            # Check to see if the file needs indexing 
    201213        my $doc_oid = $subfile->[1]; 
    202214        my $index_status = $archive_info->get_status_info($doc_oid); 
    203215        if ($index_status eq "B") 
    204216        { 
    205             # Don't process this file 
     217            # Don't process this file as it has already been indexed 
    206218            $process_file = 0; 
    207219        }