Changeset 23052 for main


Ignore:
Timestamp:
2010-10-06T15:32:01+13:00 (14 years ago)
Author:
kjdon
Message:

need to read in collect.cfg or collectionConfig.xml to see what the infodbtype is, in order to determine if we have an existing archives database or not. Can't just assume gdbm

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/bin/script/incremental-import.pl

    r21733 r23052  
    9595    print STDERR "Unable to use collection \"$collection\" within \"$collect_dir\"\n";
    9696    exit -1;
    97     }   
    98 
     97    }
     98    my $gs_mode = "gs2";
     99    if ((defined $site) && ($site ne "")) {
     100    $gs_mode = "gs3";
     101    }
     102   
    99103    if (!defined $archive_dir) {
    100     $archive_dir = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "archives")
     104    $archive_dir = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "archives");
    101105    }
    102 
     106    my $etcdir = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "etc");
    103107    # BACKWARDS COMPATIBILITY: Just in case there are old .ldb/.bdb files (won't do anything for other infodbtypes)
    104108    &util::rename_ldb_or_bdb_file(&util::filename_cat($archive_dir, "archiveinf-doc"));
    105109   
    106     my $archiveinf_doc = &dbutil::get_infodb_file_path("gdbm", "archiveinf-doc", $archive_dir);
     110    my $col_cfg_file;
     111    if ($gs_mode eq "gs3") {
     112    $col_cfg_file = &util::filename_cat($etcdir, "collectionConfig.xml");
     113    } else {
     114    $col_cfg_file = &util::filename_cat($etcdir, "collect.cfg");
     115    }
     116
     117    my $collect_cfg = &colcfg::read_collection_cfg ($col_cfg_file, $gs_mode);
     118    # get the database type for this collection from its configuration file (may be undefined)
     119    my $infodbtype = $collect_cfg->{'infodbtype'} || &dbutil::get_default_infodb_type();
     120
     121    my $archiveinf_doc_file_path = &dbutil::get_infodb_file_path($infodbtype, "archiveinf-doc", $archive_dir);
    107122
    108123    my $quoted_argv = join(" ", map { "\"$_\"" } @filtered_argv);
     
    121136    }
    122137
    123     if (-e $archiveinf_doc) {
     138    if (-e $archiveinf_doc_file_path) {
    124139    $import_cmd .= " -incremental";
    125140   
Note: See TracChangeset for help on using the changeset viewer.