Changeset 19789

Show
Ignore:
Timestamp:
10.06.2009 13:43:04 (10 years ago)
Author:
davidb
Message:

Fixed error in code that works out if a file as associated or not based in information in archives-src.gdb

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/inexport.pm

    r19498 r19789  
    2727 
    2828use strict; 
     29 
     30use File::Basename; 
    2931 
    3032use util; 
     
    179181    my ($file,$doc_rec) = @_; 
    180182 
     183    my ($file_root,$dirname,$suffix) = fileparse($file, "\\.[^\\.]+\$"); 
     184 
    181185    foreach my $af (@{$doc_rec->{'assoc-file'}}) { 
    182     return 1 if ($af eq $file); 
     186    my $full_af = &util::filename_cat($dirname,$af); 
     187 
     188    return 1 if ($full_af eq $file); 
    183189    } 
    184190 
     
    200206    foreach my $file (@$deleted_files) { 
    201207    # use 'archiveinf-src' GDBM file to look up all the OIDs 
    202     # this file is used in (note in most cases, it's just one OID) 
     208    # that this file is used in (note in most cases, it's just one OID) 
    203209     
    204210    my $src_rec = GDBMUtils::gdbmRecordToHash($arcinfo_src_filename,$file); 
     
    245251             
    246252            $block_hash->{'reindex_files'}->{$src_filename} = 1; 
     253 
     254            # remove the metadata file from the src-database 
     255            GDBMUtils::gdbmDatabaseRemove($arcinfo_src_filename,$file); 
    247256        } 
    248257        else { 
     
    254263        # Whether the main file directly or indirectly, mark for deletion/reindex 
    255264 
    256         if ($verbosity>1) { 
    257             print STDERR "$oid ($src_file) marked to be $mode_text on next buildcol.pl\n"; 
    258         } 
    259         $archive_info->set_status_info($oid,"D"); 
    260  
    261265        my $val = &GDBMUtils::gdbmDatabaseGet($arcinfo_doc_filename,$oid); 
    262266        my ($index_status) = ($val =~ m/^<index-status>(.*)$/m); 
     267 
     268 
    263269        if ($index_status ne "D") { 
     270            if ($verbosity>1) { 
     271            print STDERR "$oid ($src_file) marked to be $mode_text on next buildcol.pl\n"; 
     272            } 
     273            $archive_info->set_status_info($oid,"D"); 
     274 
    264275            $val =~ s/^<index-status>(.*)$/<index-status>D/m; 
    265276            &GDBMUtils::gdbmDatabaseSet($arcinfo_doc_filename,$oid,$val); 
     277 
     278            GDBMUtils::gdbmDatabaseRemove($arcinfo_src_filename,$src_file); 
    266279        } 
    267280 
    268         GDBMUtils::gdbmDatabaseRemove($arcinfo_src_filename,$src_file); 
     281 
    269282        } 
    270283