Ignore:
Timestamp:
2010-02-24T13:56:56+13:00 (14 years ago)
Author:
kjdon
Message:

a little tidying up and code reuse and making these work for gs3 with -site arg

File:
1 edited

Legend:

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

    r21732 r21733  
    4343use dbutil;
    4444use util;
    45 
     45use colcfg;
    4646
    4747sub main
     
    6161
    6262
    63     my $collect = pop @argv;
     63    my $collection = pop @argv;
    6464
    6565    my @filtered_argv = ();
     
    6767    my $collect_dir = undef;
    6868    my $archive_dir  = undef;
     69    my $site = undef;
    6970
    7071    while (my $arg = shift @argv) {
     
    8182        push(@filtered_argv,$arg,$archive_dir);
    8283    }
     84    elsif ($arg eq "-site") {
     85        $site = shift @argv;
     86        push(@filtered_argv,$arg,$site);
     87    }
    8388    else {
    8489        push(@filtered_argv,$arg);
    8590    }
    8691    }
    87 
    88     if (!defined $collect_dir) {
    89     $collect_dir = &util::filename_cat($ENV{'GSDLHOME'},"collect");
    90     }
    91     my $this_collect_dir = &util::filename_cat($collect_dir,$collect);
    92 
    93     if (!-d $this_collect_dir) {
    94     print STDERR "Error: $this_collect_dir does not exist\n";
    95     exit(-1);
    96     }
    97 
     92   
     93    # get and check the collection name
     94    if ((&colcfg::use_collection($site, $collection, $collect_dir)) eq "") {
     95    print STDERR "Unable to use collection \"$collection\" within \"$collect_dir\"\n";
     96    exit -1;
     97    }   
    9898
    9999    if (!defined $archive_dir) {
    100     $archive_dir = &util::filename_cat($this_collect_dir,"archives");
     100    $archive_dir = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "archives")
    101101    }
    102102
     
    132132    }
    133133
    134     $import_cmd .= " $quoted_argv \"$collect\"";
     134    $import_cmd .= " $quoted_argv \"$collection\"";
    135135
    136136   
Note: See TracChangeset for help on using the changeset viewer.