root/gsdl/trunk/bin/script/export.pl @ 15620

Revision 15620, 20.3 KB (checked in by ak19, 11 years ago)

Reads collectionConfig.xml file's collection name and description as collectionmeta for GS3, just as these elements were part of the collectionmeta for Greenstone 2

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1#!/usr/bin/perl -w
2
3###########################################################################
4#
5# export.pl --
6# A component of the Greenstone digital library software
7# from the New Zealand Digital Library Project at the
8# University of Waikato, New Zealand.
9#
10# Copyright (C) 1999 New Zealand Digital Library Project
11#
12# This program is free software; you can redistribute it and/or modify
13# it under the terms of the GNU General Public License as published by
14# the Free Software Foundation; either version 2 of the License, or
15# (at your option) any later version.
16#
17# This program is distributed in the hope that it will be useful,
18# but WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20# GNU General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License
23# along with this program; if not, write to the Free Software
24# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25#
26###########################################################################
27
28
29# This program will export a particular collection into a specific Format (e.g. METS or DSpace)
30# Author: Chi-Yu Huang Date: 08-10-2004
31
32package export;
33
34BEGIN {
35    die "GSDLHOME not set\n" unless defined $ENV{'GSDLHOME'};
36    die "GSDLOS not set\n" unless defined $ENV{'GSDLOS'};
37    unshift (@INC, "$ENV{'GSDLHOME'}/perllib");
38    unshift (@INC, "$ENV{'GSDLHOME'}/perllib/cpan");
39    unshift (@INC, "$ENV{'GSDLHOME'}/perllib/plugins");
40    unshift (@INC, "$ENV{'GSDLHOME'}/perllib/plugouts");
41    unshift (@INC, "$ENV{'GSDLHOME'}/perllib/classify");
42
43    if (defined $ENV{'GSDLEXTS'}) {
44    my @extensions = split(/:/,$ENV{'GSDLEXTS'});
45    foreach my $e (@extensions) {
46        my $ext_prefix = "$ENV{'GSDLHOME'}/ext/$e";
47
48        unshift (@INC, "$ext_prefix/perllib");
49        unshift (@INC, "$ext_prefix/perllib/cpan");
50    }
51    }
52}
53
54use strict;
55no strict 'refs'; # allow filehandles to be variables and vice versa
56no strict 'subs'; # allow barewords (eg STDERR) as function arguments
57
58use arcinfo;
59use colcfg;
60use plugin;
61use plugout;
62use manifest;
63use util;
64use scriptutil;
65use FileHandle;
66use gsprintf 'gsprintf';
67use printusage;
68use parse2;
69
70
71my $oidtype_list =
72    [ { 'name' => "hash",
73        'desc' => "{import.OIDtype.hash}" },
74      { 'name' => "assigned",
75        'desc' => "{import.OIDtype.assigned}" },
76      { 'name' => "incremental",
77        'desc' => "{import.OIDtype.incremental}" },
78      { 'name' => "dirname",
79        'desc' => "{import.OIDtype.dirname}" } ];
80
81#** define to use the METS format or DSpace format
82my $saveas_list =
83    [ { 'name' => "DSpace",
84        'desc' => "{export.saveas.DSpace}" },
85      { 'name' => "GreenstoneMETS",
86        'desc' => "{export.saveas.GreenstoneMETS}"},
87      { 'name' => "FedoraMETS",
88        'desc' => "{export.saveas.FedoraMETS}"},
89      { 'name' => "GA",
90        'desc' => "{export.saveas.GA}"},
91      { 'name' => "MARCXML",
92        'desc' => "{export.saveas.MARCXML}"}
93     ];
94
95
96# Possible attributes for each argument
97# name: The name of the argument
98# desc: A description (or more likely a reference to a description) for this argument
99# type: The type of control used to represent the argument. Options include: string, int, flag, regexp, metadata, language, enum etc
100# reqd: Is this argument required?
101# hiddengli: Is this argument hidden in GLI?
102# modegli: The lowest detail mode this argument is visible at in GLI
103
104my $saveas_argument =
105      { 'name' => "saveas",
106    'desc' => "{export.saveas}",
107    'type' => "enum",
108    'list' => $saveas_list,
109    'deft' => "METS",
110    'reqd' => "no",
111    'modegli' => "3" };
112
113
114my $arguments =
115    [
116      $saveas_argument,
117      { 'name' => "exportdir",
118    'desc' => "{export.exportdir}",
119    'type' => "string",
120    'reqd' => "no",
121        'hiddengli' => "yes" },
122      { 'name' => "importdir",
123    'desc' => "{import.importdir}",
124    'type' => "string",
125    'reqd' => "no",
126        'hiddengli' => "yes" },
127      { 'name' => "site",
128    'desc' => "{import.site}",
129    'type' => "string",
130    'deft' => "",
131    'reqd' => "no",
132        'hiddengli' => "yes" },
133      { 'name' => "collectdir",
134    'desc' => "{export.collectdir}",
135    'type' => "string",
136    # parsearg left "" as default
137    #'deft' => &util::filename_cat ($ENV{'GSDLHOME'}, "collect"),
138    'deft' => "",
139    'reqd' => "no",
140    'hiddengli' => "yes" },
141      { 'name' => "manifest",
142    'desc' => "{import.manifest}",
143    'type' => "string",
144    'deft' => "",
145    'reqd' => "no",
146        'hiddengli' => "yes" },
147      { 'name' => "listall",
148    'desc' => "{export.listall}",
149    'type' => "flag",
150    'reqd' => "no" },
151      { 'name' => "debug",
152    'desc' => "{export.debug}",
153    'type' => "flag",
154    'reqd' => "no",
155        'hiddengli' => "yes" },
156      { 'name' => "faillog",
157    'desc' => "{export.faillog}",
158    'type' => "string",
159    'deft' => "",
160    'reqd' => "no",
161        'modegli' => "4" },
162      { 'name' => "incremental",
163    'desc' => "{import.incremental}",
164    'type' => "flag",
165    'hiddengli' => "yes" },
166      { 'name' => "keepold",
167    'desc' => "{export.keepold}",
168    'type' => "flag",
169    'reqd' => "no",
170    'hiddengli' => "yes" },
171      { 'name' => "removeold",
172    'desc' => "{export.removeold}",
173    'type' => "flag",
174    'reqd' => "no",
175    'modegli' => "3" },
176      { 'name' => "language",
177    'desc' => "{scripts.language}",
178    'type' => "string",
179    'reqd' => "no",
180    'modegli' => "4" },
181      { 'name' => "maxdocs",
182    'desc' => "{export.maxdocs}",
183    'type' => "int",
184    'reqd' => "no",
185    'range' => "1,",
186    'modegli' => "1" },
187      { 'name' => "OIDtype",
188    'desc' => "{import.OIDtype}",
189    'type' => "enum",
190    'list' => $oidtype_list,
191    # parsearg left "" as default
192    #'deft' => "hash",
193    'reqd' => "no",
194    'modegli' => "3" },
195      { 'name' => "OIDmetadata",
196    'desc' => "{import.OIDmetadata}",
197    'type' => "metadata",
198    'deft' => "dc.Identifier",
199    'reqd' => "no",
200    'modegli' => "3" },
201      { 'name' => "out",
202    'desc' => "{export.out}",
203    'type' => "string",
204    'deft' => "STDERR",
205    'reqd' => "no",
206        'hiddengli' => "yes" },
207      { 'name' => "statsfile",
208    'desc' => "{export.statsfile}",
209    'type' => "string",
210    'deft' => "STDERR",
211    'reqd' => "no",
212        'hiddengli' => "yes" },
213      { 'name' => "xsltfile",
214    'desc' => "{BasPlugout.xslt_file}",
215    'type' => "string",
216    'reqd' => "no",
217        'hiddengli' => "yes" },
218      { 'name' => "xslt_txt",
219    'desc' => "{METSPlugout.xslt_txt}",
220    'type' => "string",
221    'reqd' => "no",
222        'hiddengli' => "no" },
223      { 'name' => "xslt_mets",
224    'desc' => "{METSPlugout.xslt_mets}",
225    'type' => "string",
226    'reqd' => "no",
227        'hiddengli' => "no" },
228      { 'name' => "fedora_namespace",
229    'desc' => "{FedoraMETSPlugout.fedora_namespace}",
230    'type' => "string",
231    'deft' => "greenstone",
232    'reqd' => "no",
233        'hiddengli' => "no" },
234      { 'name' => "mapping_file",
235    'desc' => "{MARCXMLPlugout.mapping_file}",
236    'type' => "string",
237    'reqd' => "no",
238        'hiddengli' => "no" },
239      { 'name' => "group_marc",
240    'desc' => "{MARCXMLPlugout.group}",
241    'type' => "flag",
242    'reqd' => "no",
243        'hiddengli' => "no" },
244      { 'name' => "verbosity",
245    'desc' => "{export.verbosity}",
246    'type' => "int",
247    'range' => "0,3",
248    'deft' => "2",
249    'reqd' => "no",
250    'modegli' => "4" },
251      { 'name' => "gli",
252    'desc' => "",
253    'type' => "flag",
254    'reqd' => "no",
255    'hiddengli' => "yes" },
256      { 'name' => "xml",
257    'desc' => "{scripts.xml}",
258    'type' => "flag",
259    'reqd' => "no",
260    'hiddengli' => "yes" }
261      ];
262
263my $options = { 'name' => "export.pl",
264        'desc' => "{export.desc}",
265        'args' => $arguments };
266
267my $listall_options = { 'name' => "export.pl",
268                'desc' => "{export.desc}",
269                'args' => [ $saveas_argument ] };
270
271#sub gsprintf
272#{
273#    return &gsprintf::gsprintf(@_);
274#}
275
276
277sub store_collectionmeta
278{
279    my ($collectionmeta,$field,$doc_obj) = @_;
280
281    my $section = $doc_obj->get_top_section();
282
283    my $field_hash = $collectionmeta->{$field};
284
285    foreach my $k (keys %$field_hash)
286    {
287    my $val = $field_hash->{$k};
288
289    ### print STDERR "*** $k = $field_hash->{$k}\n";
290
291    my $md_label = "ex.$field";
292
293
294    if ($k =~ m/^\[l=(.*?)\]$/)
295    {
296
297        my $md_suffix = $1;
298        $md_label .= "^$md_suffix";
299    }
300
301
302    $doc_obj->add_utf8_metadata($section,$md_label, $val);
303   
304    # see cfgread4gs3.pm: GS2's "collectionextra" is called "description" in GS3,
305    # while "collectionname" in GS2 is called "name" in GS3.
306    # Variable $nameMap variable in cfgread4gs3.pm maps between GS2 and GS3
307    if (($md_label eq "ex.collectionname^en") || ($md_label eq "ex.collectionname"))
308    {
309        $doc_obj->add_utf8_metadata($section,"dc.Title", $val);
310    }
311
312    }
313}
314
315
316&main();
317
318sub main {
319    # params
320    my ($language, $verbosity, $debug,
321    $importdir, $manifest, $incremental, $keepold,
322    $exportdir, $site, $listall,
323    $removeold, $saveas,
324    $OIDtype, $OIDmetadata,
325    $out, $faillog, $collectdir, $gli,
326    $gs_mode, $collectcfg,
327    $maxdocs, $statsfile,
328    $mapping_file,
329    $xsltfile,
330    $xslt_mets, $xslt_txt, $fedora_namespace, $group_marc);
331
332    my $xml = 0;
333   
334    # other vars
335    my ($configfilename, $collection,
336    $export_info_filename, $export_info,
337    $processor, $pluginfo);
338
339    my $service = "export";
340
341    my $hashParsingResult = {};
342    # general options available to all plugins
343    my $intArgLeftinAfterParsing = parse2::parse(\@ARGV,$arguments,$hashParsingResult,"allow_extra_options");
344   
345    # If parse returns -1 then something has gone wrong
346    if ($intArgLeftinAfterParsing == -1)
347    {
348    &PrintUsage::print_txt_usage($options, "{export.params}");
349    die "\n";
350    }
351
352    foreach my $strVariable (keys %$hashParsingResult)
353    {
354    eval "\$$strVariable = \$hashParsingResult->{\"\$strVariable\"}";
355    }
356
357   
358    # these are options used by other things - we just set default values
359    # undef means will be set from config file if there
360    my $gzip = undef;
361    my $groupsize = 1;
362    #my $OIDtype = undef;
363    my $sortmeta = undef;
364
365    my $explicit_exportdir = (defined $exportdir) ? 1 : 0;
366
367    # save these command line settings. don't want config file settings in one
368    # coll used for other colls
369    # does this apply to other vars???
370    my $global_removeold = $removeold;
371    my $global_keepold = $keepold;
372    # If $language has been specified, load the appropriate resource bundle
373    # (Otherwise, the default resource bundle will be loaded automatically)
374    if ($language) {
375    &gsprintf::load_language_specific_resource_bundle($language);
376    }
377
378    if ($listall) {
379    if ($xml) {
380        &PrintUsage::print_xml_usage($listall_options);
381    }
382    else
383    {
384        &PrintUsage::print_txt_usage($listall_options,"{export.params}");
385    }
386    die "\n";
387    }
388    elsif ($xml) {
389        &PrintUsage::print_xml_usage($options);
390    die "\n";
391    }
392
393    # can have more than one collection name, 
394    # if the first extra option is -h, then output the help
395    if (scalar(@ARGV) == 0 || (@ARGV && $ARGV[0] =~ /^\-+h/)) {
396    &PrintUsage::print_txt_usage($options, "{export.params}");
397    die "\n";
398    }
399
400    if ($gli) { # the gli wants strings to be in UTF-8
401    &gsprintf::output_strings_in_UTF8;
402    }
403    my $close_out = 0;
404    if ($out !~ /^(STDERR|STDOUT)$/i) {
405    open (OUT, ">$out") ||
406        (&gsprintf(STDERR, "{common.cannot_open_output_file}\n", $out) && die);
407    $out = 'export::OUT';
408    $close_out = 1;
409    }
410    $out->autoflush(1);
411
412    while (scalar(@ARGV)>0) {
413    my $collect_name = shift @ARGV;
414    $ENV{'GSDLCOLLECTION'} = $collect_name;
415
416    eval {
417        # get and check the collection name
418        if (($collection = &colcfg::use_collection($site, $collect_name, $collectdir)) eq "") {
419        &PrintUsage::print_txt_usage($options, "{export.params}");
420        die "\n";
421        }
422        # add collection's perllib dir  into include path in
423        # case we have collection specific modules
424        unshift (@INC, "$ENV{'GSDLCOLLECTDIR'}/perllib");
425       
426        if ($faillog eq "") {
427        $faillog = &util::filename_cat($ENV{'GSDLCOLLECTDIR'}, "etc", "fail.log");
428        }
429        open (FAILLOG, ">$faillog") ||
430        (&gsprintf(STDERR, "{export.cannot_open_fail_log}\n", $faillog) && die);
431        my $faillogname = $faillog;
432        $faillog = 'export::FAILLOG';
433        $faillog->autoflush(1);
434       
435        # check sortmeta
436        $sortmeta = undef unless defined $sortmeta && $sortmeta =~ /\S/;
437        if (defined $sortmeta && $groupsize > 1) {
438        &gsprintf($out, "{export.cannot_sort}\n\n");
439        $sortmeta = undef;
440        }
441       
442        # get the list of plugins for this collection and set any options that
443        # were specified in the collect.cfg (all export.pl options except
444        # -collectdir, -out and -faillog may be specified in the collect.cfg (these
445        # options must be known before we read the collect.cfg))
446        my $plugins = [];
447        my @global_opts = ();
448
449        # Read in the collection configuration file.
450        ($configfilename, $gs_mode) = &colcfg::get_collect_cfg_name($out);
451
452        if ($gs_mode eq "gs2") {
453        $collectcfg = &colcfg::read_collect_cfg ($configfilename);
454        } elsif ($gs_mode eq "gs3") {
455        $collectcfg = &colcfg::read_collection_cfg_xml ($configfilename);
456        }
457
458        if (defined $collectcfg->{'importdir'} && $importdir eq "") {
459        $importdir = $collectcfg->{'importdir'};
460        }
461        if (defined $collectcfg->{'exportdir'} && $exportdir eq "") {
462        $exportdir = $collectcfg->{'exportdir'};
463        }
464
465        # fill in the default import and export directories if none
466        # were supplied, turn all \ into / and remove trailing /
467        $importdir = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "import") if $importdir eq "";
468        $importdir =~ s/[\\\/]+/\//g;
469        $importdir =~ s/\/$//;
470        if (!-e $importdir) {
471        &gsprintf($out, "{import.no_import_dir}\n\n", $importdir);
472        die "\n";
473        }
474
475        $exportdir = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "export") if $exportdir eq "";
476        $exportdir =~ s/[\\\/]+/\//g;
477        $exportdir =~ s/\/$//;
478
479        if (defined $collectcfg->{'plugin'}) {
480        $plugins = $collectcfg->{'plugin'};
481        }
482       
483        if ($verbosity !~ /\d+/) {
484        if (defined $collectcfg->{'verbosity'} && $collectcfg->{'verbosity'} =~ /\d+/) {
485            $verbosity = $collectcfg->{'verbosity'};
486        } else {
487            $verbosity = 2; # the default
488        }
489        }
490
491        if (defined $collectcfg->{'gzip'} && !$gzip) {
492        if ($collectcfg->{'gzip'} =~ /^true$/i) {
493            $gzip = 1;
494        }
495        }
496        if ($maxdocs !~ /\-?\d+/) {
497        if (defined $collectcfg->{'maxdocs'} && $collectcfg->{'maxdocs'} =~ /\-?\d+/) {
498            $maxdocs = $collectcfg->{'maxdocs'};
499        } else {
500            $maxdocs = -1; # the default
501        }
502        }
503        if ($groupsize == 1) {
504        if (defined $collectcfg->{'groupsize'} && $collectcfg->{'groupsize'} =~ /\d+/) {
505            $groupsize = $collectcfg->{'groupsize'};
506        }
507        }
508        if (!defined $OIDtype || ($OIDtype !~ /^(hash|incremental|assigned|dirname)$/)) {
509        if (defined $collectcfg->{'OIDtype'} && $collectcfg->{'OIDtype'} =~ /^(hash|incremental)$/) {
510            $OIDtype = $collectcfg->{'OIDtype'};
511        } else {
512            $OIDtype = "hash"; # the default
513        }
514        }
515        if (defined $collectcfg->{'sortmeta'} && $sortmeta eq "") {
516        $sortmeta = $collectcfg->{'sortmeta'};
517        }
518        if (defined $collectcfg->{'debug'} && $collectcfg->{'debug'} =~ /^true$/i) {
519        $debug = 1;
520        }
521        if (defined $collectcfg->{'gli'} && $collectcfg->{'gli'} =~ /^true$/i) {
522        $gli = 1;
523        }
524       
525        # global plugin stuff
526        if (defined $collectcfg->{'separate_cjk'}&& $collectcfg->{'separate_cjk'} =~ /^true$/i) {
527        push @global_opts, "-separate_cjk";
528        }
529       
530        ($removeold, $keepold) = &scriptutil::check_removeold_and_keepold($global_removeold, $global_keepold, 0, "export", $collectcfg);
531
532        $gli = 0 unless defined $gli;
533
534        print STDERR "<export>\n" if $gli;
535       
536        # fill in the default import and export directories if none
537        # were supplied, turn all \ into / and remove trailing /
538        $importdir = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "import") if $importdir eq "";
539        $importdir =~ s/[\\\/]+/\//g;
540        $importdir =~ s/\/$//;
541        $exportdir = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "export") if $exportdir eq "";
542        $exportdir =~ s/[\\\/]+/\//g;
543        $exportdir =~ s/\/$//;
544       
545        # load all the plugins
546        $pluginfo = &plugin::load_plugins ($plugins, $verbosity, $out, $faillog, \@global_opts);
547       
548        if (scalar(@$pluginfo) == 0) {
549        &gsprintf($out, "{import.no_plugins_loaded}\n");
550        die "\n";
551        }
552       
553        # remove the old contents of the export directory if needed
554        if ($removeold && -e $exportdir) {
555        &gsprintf($out, "{export.removing_export}\n");
556        &util::rm_r ($exportdir);
557        }
558       
559        # read the export information file
560       
561        # Export to DSpace Archive format or METs format
562        # If saveas=DSpace, a "contents" file will be created, otherwise "export.inf"
563       
564        # the plugouts should be doing this!!
565        if ($saveas eq "DSpace"){
566        $export_info_filename = &util::filename_cat ($exportdir, "contents");
567        } elsif ($saveas =~ m/^.*METS$/ || $saveas eq "GA" || $saveas eq "MARC" ) {
568        $export_info_filename = &util::filename_cat ($exportdir, "export.inf");
569        }
570       
571        $export_info = new arcinfo();
572        $export_info -> load_info ($export_info_filename); 
573       
574        my ($plugout);
575        if (defined $collectcfg->{'plugout'}) {
576        $plugout = $collectcfg->{'plugout'};
577        }
578        else{
579        if ($saveas !~ /^(GA|.*METS|DSpace|MARCXML)$/) {
580            push @$plugout,"GAPlugout";
581        }
582        else{
583            push @$plugout,$saveas."Plugout";
584        }
585        }
586
587        my $plugout_name = $plugout->[0];
588       
589        push @$plugout,("-output_info",$export_info) if (defined $export_info);
590        push @$plugout,("-verbosity",$verbosity) if (defined $verbosity);
591        push @$plugout,("-debug") if ($debug);
592        push @$plugout,("-gzip_output",$gzip) if (defined $gzip);
593        push @$plugout,("-group_size",$groupsize) if (defined $groupsize);
594        push @$plugout,("-output_handle",$out) if (defined $out);
595        push @$plugout,("-xslt_file",$xsltfile) if (defined $xsltfile);
596        push @$plugout,("-group") if ($group_marc && $plugout_name =~ m/^MARCXMLPlugout$/);
597        push @$plugout,("-mapping_file",$mapping_file) if (defined $mapping_file && $plugout_name =~ m/^MARCXMLPlugout$/);
598        push @$plugout,("-xslt_mets",$xslt_mets) if (defined $xslt_mets && $plugout_name =~ m/^.*METSPlugout$/);
599        push @$plugout,("-xslt_txt",$xslt_txt) if (defined $xslt_txt && $plugout_name =~ m/^.*METSPlugout$/);
600        push @$plugout,("-fedora_namespace",$fedora_namespace) if (defined $fedora_namespace && $plugout_name eq "FedoraMETSPlugout");
601
602        $processor = &plugout::load_plugout($plugout);   
603       
604        $processor->setoutputdir ($exportdir);
605       
606        $processor->set_sortmeta ($sortmeta) if defined $sortmeta;
607        $processor->set_OIDtype ($OIDtype, $OIDmetadata);
608       
609        &plugin::begin($pluginfo, $importdir, $processor, $maxdocs);
610       
611        # process the import directory
612        &plugin::read ($pluginfo, $importdir, "", {}, $processor, $maxdocs,0, $gli);
613
614        if ($saveas eq "FedoraMETS")
615        {
616        # create collection "doc obj" for Fedora that contains
617        # collection-level metadata
618
619        my $doc_obj = new doc($configfilename,"nonindexed_doc");
620        $doc_obj->set_OID("collection");
621       
622        my $col_name = undef;
623        my $col_meta = $collectcfg->{'collectionmeta'};
624       
625        if (defined $col_meta)
626        {
627            store_collectionmeta($col_meta,"collectionname",$doc_obj); # in GS3 this is a collection's name
628            store_collectionmeta($col_meta,"collectionextra",$doc_obj); # in GS3 this is a collection's description
629           
630        }
631        $processor->process($doc_obj);
632        }
633       
634        &plugin::end($pluginfo, $processor);
635
636        &plugin::deinit($pluginfo, $processor);
637       
638        # write out the export information file
639        $processor->close_file_output() if $groupsize > 1;
640        $processor->close_group_output() if $processor->is_group();
641        if ($saveas =~ m/^.*METS$/) {
642        $export_info->save_info($export_info_filename);
643        }
644       
645        # write out export stats
646        my $close_stats = 0;
647        if ($statsfile !~ /^(STDERR|STDOUT)$/i) {
648        if (open (STATS, ">$statsfile")) {
649            $statsfile = 'import::STATS';
650            $close_stats = 1;
651        } else {
652            &gsprintf($out, "{import.cannot_open_stats_file}", $statsfile);
653            &gsprintf($out, "{import.stats_backup}\n");
654            $statsfile = 'STDERR';
655        }
656        }
657
658        &gsprintf($out, "\n");
659        &gsprintf($out, "*********************************************\n");
660
661        &plugin::write_stats($pluginfo, $statsfile, $faillogname, $gli);
662        if ($close_stats) {
663        close STATS;
664        }
665
666        &gsprintf($out, "*********************************************\n");
667
668        close OUT if $close_out;
669
670        close FAILLOG;
671    };
672
673    if ($@) {
674        print STDERR $@;
675    }
676
677##  $ENV{'GSDLCOLLECTION'} = undef;
678    $importdir = "";
679    $removeold = 0 if ($explicit_exportdir);
680
681    } # while processing ARGV
682   
683    &gsprintf($out, "\n");
684    &gsprintf($out, "*********************************************\n");
685    &gsprintf($out, "* {export.complete}\n");
686    &gsprintf($out, "*********************************************\n");   
687
688}
Note: See TracBrowser for help on using the browser.