Changeset 23144


Ignore:
Timestamp:
2010-10-17T14:43:08+13:00 (11 years ago)
Author:
davidb
Message:

Script now correctly determines the infodb type by parsing the collect.cfg file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/cgi-bin/talkback-transfer.pl

    r23142 r23144  
    2020sub get_infodb_type
    2121{
    22     my ($collect_home,$collect) = @_;
     22    my ($opt_site,$collect_home,$collect) = @_;
    2323
    24     print STDERR "*** Need to implement extracting infodb_type from collect.cfg\n";
    25     return "gdbm";
     24    my $out = "STDERR";
     25
     26    $collect = &colcfg::use_collection($opt_site, $collect, $collect_home);
     27
     28    if ($collect eq "") {
     29    print STDERR "Error: failed to find collection $collect in $collect_home\n";
     30    print STDOUT "Content-type:text/plain\n\n";
     31    print STDOUT "ERROR: Failed to find collection $collect\n";
     32    exit 0;
     33   
     34    }
     35
     36    # Read in the collection configuration file.
     37    my ($config_filename, $gs_mode) = &colcfg::get_collect_cfg_name($out);
     38    my $collectcfg = &colcfg::read_collection_cfg ($config_filename, $gs_mode);
     39
     40    return $collectcfg->{'infodbtype'};
    2641}
    2742
     
    2944sub oid_to_docxml_filename
    3045{
    31     my ($collect_home,$collect,$docid) = @_;
     46    my ($opt_site,$collect_home,$collect,$docid) = @_;
    3247
    33     my $infodb_type = get_infodb_type($collect_home,$collect);
     48    my $infodb_type = get_infodb_type($opt_site,$collect_home,$collect);
    3449
    35     # Obtain the collect and archive dir   
    36     my $archive_dir = &util::filename_cat($collect_home,$collect,"archives");
     50    # Obtain the collect and archives dir   
     51    my $archives_dir = &util::filename_cat($collect_home,$collect,"archives");
    3752
    3853    # Obtain the doc.xml path for the specified docID
    3954    my $arcinfo_doc_filename
    4055    = &dbutil::get_infodb_file_path($infodb_type, "archiveinf-doc",
    41                     $archive_dir);
     56                    $archives_dir);
    4257    my $doc_rec_string
    4358    = &dbutil::read_infodb_entry($infodb_type, $arcinfo_doc_filename,
     
    4863    # The $doc_xml_file is relative to the archives, so now let's get the
    4964    # full path
    50     my $archives_dir = &util::filename_cat($collect_home,$collect,"archives");   
    5165    my $doc_xml_filename = &util::filename_cat($archives_dir,$doc_xml_file);
    5266
     
    6882    my $oid     = $gsdl_cgi->param('oid');
    6983    my $collect = $gsdl_cgi->param('collect');
     84    my $site    = $gsdl_cgi->param('site');
    7085
    7186    # sanity check
     
    7893    my $uniq_prefix = "$collect-$oid";
    7994
    80     my $docxml_filename = oid_to_docxml_filename($collect_home,$collect,$oid);
     95    my $docxml_filename = oid_to_docxml_filename($site,$collect_home,$collect,$oid);
    8196
    8297    my $talktoUploadURL = $gsdl_cgi->param('talktoUpload');
Note: See TracChangeset for help on using the changeset viewer.