Ignore:
Timestamp:
2016-11-21T13:50:51+13:00 (7 years ago)
Author:
kjdon
Message:

added a new flag to import -NO_IMPORT. set it in collectionConfig.xml as an importOption to prevent import.pl being accidentally run. If you are doing web editing of documents, it edits the archives files and running import will clobber any changes

File:
1 edited

Legend:

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

    r29107 r31132  
    6969# Pragma
    7070use strict;
     71no strict 'subs'; # allow barewords (eg STDERR) as function arguments
    7172use warnings;
    7273
     
    147148    'reqd' => "no",
    148149    'modegli' => "3" },
    149      @$inexport::arguments
     150     @$inexport::arguments,
     151      { 'name' => "NO_IMPORT",
     152    'desc' => "{import.NO_IMPORT}",
     153    'type' => "flag",
     154    'reqd' => "no",
     155    'modegli' => "3"}
    150156];
    151157
     
    175181  foreach my $argument (@ARGV)
    176182  {
     183      if ($argument eq "-NO_IMPORT") {
     184      &gsprintf(STDERR, "{import.NO_IMPORT_set}\n\n"); 
     185      exit 0;
     186      }
    177187    # proper arguments start with a hyphen
    178188    if ($argument =~ /^-/ && defined $function_to_inexport_subclass_mappings->{$argument})
     
    213223  {
    214224    my ($config_filename,$collect_cfg) = $inexport->read_collection_cfg($collection,$options);
    215 
     225    if ($collect_cfg->{'NO_IMPORT'}) {
     226    &gsprintf(STDERR, "{import.NO_IMPORT_set}\n\n");   
     227    exit 0;
     228    }
    216229    #$inexport->set_collection_options($collect_cfg);
    217230    &set_collection_options($inexport, $collect_cfg);
    218231
     232   
    219233    my $pluginfo = $inexport->process_files($config_filename,$collect_cfg);
    220234
Note: See TracChangeset for help on using the changeset viewer.