Changeset 21614

Show
Ignore:
Timestamp:
25.01.2010 16:30:53 (9 years ago)
Author:
mdewsnip
Message:

Changed ArchivesInfPlugin?.pm so it uses the infodbtype value from the collect.cfg file, instead of always using GDBM. Part of making the code less GDBM-specific.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/plugins/ArchivesInfPlugin.pm

    r21566 r21614  
    100100 
    101101    if (defined $archive_info) { 
     102        # Get the infodbtype value for this collection from the arcinfo object 
     103        my $infodbtype = $archive_info->{'infodbtype'}; 
    102104    my $archive_info_filename = $self->{'archive_info_filename'}; 
    103     my $infodb_file_handle = &dbutil::open_infodb_write_handle("gdbm", $archive_info_filename, "append"); 
     105    my $infodb_file_handle = &dbutil::open_infodb_write_handle($infodbtype, $archive_info_filename, "append"); 
    104106 
    105107        my $file_list = $archive_info->get_file_list(); 
     
    113115        # delete 
    114116        $archive_info->delete_info($doc_oid); 
    115         &dbutil::delete_infodb_entry("gdbm", $infodb_file_handle, $doc_oid); 
     117        &dbutil::delete_infodb_entry($infodbtype, $infodb_file_handle, $doc_oid); 
    116118 
    117119        my $doc_file = $subfile->[0]; 
     
    135137    } 
    136138 
    137     &dbutil::close_infodb_write_handle("gdbm", $infodb_file_handle); 
     139    &dbutil::close_infodb_write_handle($infodbtype, $infodb_file_handle); 
    138140    $archive_info->save_info($archive_info_filename); 
    139141    } 
     
    220222    my $count = 0; 
    221223 
     224    # This function only makes sense at build-time 
     225    return if (ref($processor) !~ /buildproc$/); 
     226 
     227    # Get the infodbtype value for this collection from the buildproc object 
     228    my $infodbtype = $processor->{'infodbtype'}; 
     229 
    222230    # see if this has a archives information file within it 
    223231##    my $archive_info_filename = &util::filename_cat($base_dir,$file,"archives.inf"); 
    224  
    225     my $archive_info_filename = &dbutil::get_infodb_file_path("gdbm", "archiveinf-doc", &util::filename_cat($base_dir, $file)); 
     232    my $archive_info_filename = &dbutil::get_infodb_file_path($infodbtype, "archiveinf-doc", &util::filename_cat($base_dir, $file)); 
    226233 
    227234    if (-e $archive_info_filename) { 
     
    231238 
    232239    # read in the archives information file 
    233     my $archive_info = new arcinfo (); 
     240    my $archive_info = new arcinfo($infodbtype); 
    234241    $self->{'archive_info'} = $archive_info; 
    235242    $self->{'archive_info_filename'} = $archive_info_filename;