Changeset 32848


Ignore:
Timestamp:
2019-03-04T13:52:41+13:00 (5 years ago)
Author:
kjdon
Message:

reindented in emacs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/inexport.pm

    r32846 r32848  
    6666
    6767$inexport::directory_arguments =
    68 [
    69       { 'name' => "importdir",
    70     'desc' => "{import.importdir}",
    71     'type' => "string",
    72     'reqd' => "no",
    73     'deft' => "import",
    74         'hiddengli' => "yes" },
    75       { 'name' => "collectdir",
    76     'desc' => "{import.collectdir}",
    77     'type' => "string",
    78     # parsearg left "" as default
    79     #'deft' => &FileUtils::filenameConcatenate($ENV{'GSDLHOME'}, "collect"),
    80     'deft' => "",
    81     'reqd' => "no",
    82         'hiddengli' => "yes" },
    83  
    84 ];
     68    [
     69     { 'name' => "importdir",
     70       'desc' => "{import.importdir}",
     71       'type' => "string",
     72       'reqd' => "no",
     73       'deft' => "import",
     74       'hiddengli' => "yes" },
     75     { 'name' => "collectdir",
     76       'desc' => "{import.collectdir}",
     77       'type' => "string",
     78       # parsearg left "" as default
     79       #'deft' => &FileUtils::filenameConcatenate($ENV{'GSDLHOME'}, "collect"),
     80       'deft' => "",
     81       'reqd' => "no",
     82       'hiddengli' => "yes" },
     83    
     84    ];
    8585$inexport::arguments =
    86 [
    87       # don't set the default to hash - want to allow this to come from
    88       # entry in collect.cfg but want to override it here
    89       { 'name' => "OIDtype",
    90     'desc' => "{import.OIDtype}",
    91     'type' => "enum",
    92     'list' => $oidtype_list,
    93     'deft' => "hash_on_full_filename",
    94     'reqd' => "no",
    95     'modegli' => "2" },
    96       { 'name' => "OIDmetadata",
    97     'desc' => "{import.OIDmetadata}",
    98     'type' => "string",
    99     'deft' => "dc.Identifier",
    100     'reqd' => "no",
    101     'modegli' => "2" },
    102       { 'name' => "site",
    103     'desc' => "{import.site}",
    104     'type' => "string",
    105     'deft' => "",
    106     'reqd' => "no",
    107         'hiddengli' => "yes" },
    108       { 'name' => "manifest",
    109     'desc' => "{import.manifest}",
    110     'type' => "string",
    111     'deft' => "",
    112     'reqd' => "no",
    113         'hiddengli' => "yes" } ,
     86    [
     87     # don't set the default to hash - want to allow this to come from
     88     # entry in collect.cfg but want to override it here
     89     { 'name' => "OIDtype",
     90       'desc' => "{import.OIDtype}",
     91       'type' => "enum",
     92       'list' => $oidtype_list,
     93       'deft' => "hash_on_full_filename",
     94       'reqd' => "no",
     95       'modegli' => "2" },
     96     { 'name' => "OIDmetadata",
     97       'desc' => "{import.OIDmetadata}",
     98       'type' => "string",
     99       'deft' => "dc.Identifier",
     100       'reqd' => "no",
     101       'modegli' => "2" },
     102     { 'name' => "site",
     103       'desc' => "{import.site}",
     104       'type' => "string",
     105       'deft' => "",
     106       'reqd' => "no",
     107       'hiddengli' => "yes" },
     108     { 'name' => "manifest",
     109       'desc' => "{import.manifest}",
     110       'type' => "string",
     111       'deft' => "",
     112       'reqd' => "no",
     113       'hiddengli' => "yes" } ,
    114114     { 'name' => "incremental",
    115     'desc' => "{import.incremental}",
    116     'type' => "flag",
    117     'hiddengli' => "yes" },
    118       { 'name' => "keepold",
    119     'desc' => "{import.keepold}",
    120     'type' => "flag",
    121     'reqd' => "no",
    122     'hiddengli' => "yes" },
    123       { 'name' => "removeold",
    124     'desc' => "{import.removeold}",
    125     'type' => "flag",
    126     'reqd' => "no",
    127     'hiddengli' => "yes" },
    128       { 'name' => "language",
    129     'desc' => "{scripts.language}",
    130     'type' => "string",
    131     'reqd' => "no",
    132     'hiddengli' => "yes" },
    133       { 'name' => "maxdocs",
    134     'desc' => "{import.maxdocs}",
    135     'type' => "int",
    136     'reqd' => "no",
    137     'deft' => "-1",
    138     'range' => "-1,",
    139     'modegli' => "1" },
    140        { 'name' => "debug",
    141     'desc' => "{import.debug}",
    142     'type' => "flag",
    143     'reqd' => "no",
    144         'hiddengli' => "yes" },
    145       { 'name' => "faillog",
    146     'desc' => "{import.faillog}",
    147     'type' => "string",
    148     # parsearg left "" as default
    149     #'deft' => &FileUtils::filenameConcatenate("<collectdir>", "colname", "etc", "fail.log"),
    150     'deft' => "",
    151     'reqd' => "no",
    152         'modegli' => "3" },
    153        { 'name' => "out",
    154     'desc' => "{import.out}",
    155     'type' => "string",
    156     'deft' => "STDERR",
    157     'reqd' => "no",
    158         'hiddengli' => "yes" },
    159       { 'name' => "statsfile",
    160     'desc' => "{import.statsfile}",
    161     'type' => "string",
    162     'deft' => "STDERR",
    163     'reqd' => "no",
    164         'hiddengli' => "yes" },
    165       { 'name' => "verbosity",
    166     'desc' => "{import.verbosity}",
    167     'type' => "int",
    168     'range' => "0,",
    169     'deft' => "2",
    170     'reqd' => "no",
    171     'modegli' => "3" },
    172       { 'name' => "gli",
    173     'desc' => "{scripts.gli}",
    174     'type' => "flag",
    175     'reqd' => "no",
    176     'hiddengli' => "yes" },
    177       { 'name' => "xml",
    178     'desc' => "{scripts.xml}",
    179     'type' => "flag",
    180     'reqd' => "no",
    181     'hiddengli' => "yes" },
    182 
    183 ];
     115       'desc' => "{import.incremental}",
     116       'type' => "flag",
     117       'hiddengli' => "yes" },
     118     { 'name' => "keepold",
     119       'desc' => "{import.keepold}",
     120       'type' => "flag",
     121       'reqd' => "no",
     122       'hiddengli' => "yes" },
     123     { 'name' => "removeold",
     124       'desc' => "{import.removeold}",
     125       'type' => "flag",
     126       'reqd' => "no",
     127       'hiddengli' => "yes" },
     128     { 'name' => "language",
     129       'desc' => "{scripts.language}",
     130       'type' => "string",
     131       'reqd' => "no",
     132       'hiddengli' => "yes" },
     133     { 'name' => "maxdocs",
     134       'desc' => "{import.maxdocs}",
     135       'type' => "int",
     136       'reqd' => "no",
     137       'deft' => "-1",
     138       'range' => "-1,",
     139       'modegli' => "1" },
     140     { 'name' => "debug",
     141       'desc' => "{import.debug}",
     142       'type' => "flag",
     143       'reqd' => "no",
     144       'hiddengli' => "yes" },
     145     { 'name' => "faillog",
     146       'desc' => "{import.faillog}",
     147       'type' => "string",
     148       # parsearg left "" as default
     149       #'deft' => &FileUtils::filenameConcatenate("<collectdir>", "colname", "etc", "fail.log"),
     150       'deft' => "",
     151       'reqd' => "no",
     152       'modegli' => "3" },
     153     { 'name' => "out",
     154       'desc' => "{import.out}",
     155       'type' => "string",
     156       'deft' => "STDERR",
     157       'reqd' => "no",
     158       'hiddengli' => "yes" },
     159     { 'name' => "statsfile",
     160       'desc' => "{import.statsfile}",
     161       'type' => "string",
     162       'deft' => "STDERR",
     163       'reqd' => "no",
     164       'hiddengli' => "yes" },
     165     { 'name' => "verbosity",
     166       'desc' => "{import.verbosity}",
     167       'type' => "int",
     168       'range' => "0,",
     169       'deft' => "2",
     170       'reqd' => "no",
     171       'modegli' => "3" },
     172     { 'name' => "gli",
     173       'desc' => "{scripts.gli}",
     174       'type' => "flag",
     175       'reqd' => "no",
     176       'hiddengli' => "yes" },
     177     { 'name' => "xml",
     178       'desc' => "{scripts.xml}",
     179       'type' => "flag",
     180       'reqd' => "no",
     181       'hiddengli' => "yes" },
     182
     183    ];
    184184
    185185sub new
     
    288288    $self->{'out'} = STDERR;
    289289   
    290     if (defined $gsdl_cgi) {
    291         $self->{'site'} = $opt_site;
    292         my $collect_dir = $gsdl_cgi->get_collection_dir($opt_site);
    293         $self->{'collectdir'} = $collect_dir;
    294     }
    295     else { 
    296         $self->{'site'} = "";
    297         $self->{'collectdir'} = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'},"collect");
    298     }
     290    if (defined $gsdl_cgi) {
     291    $self->{'site'} = $opt_site;
     292    my $collect_dir = $gsdl_cgi->get_collection_dir($opt_site);
     293    $self->{'collectdir'} = $collect_dir;
     294    }
     295    else { 
     296    $self->{'site'} = "";
     297    $self->{'collectdir'} = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'},"collect");
     298    }
    299299    $self->{'faillog'} = "";
    300    
     300    
    301301    $self->{'collection'} = $collect;
    302302
     
    319319    my $site       = $self->{'site'};
    320320    my $out        = $self->{'out'};
    321    
     321   
    322322    if (($collection = &colcfg::use_collection($site, $collection, $collectdir)) eq "") {
    323323    #&PrintUsage::print_txt_usage($options, "{import.params}", 1);
     
    378378    if (!defined($collectcfg->{'infodbtype'}))
    379379    {
    380       $collectcfg->{'infodbtype'} = &dbutil::get_default_infodb_type();
     380    $collectcfg->{'infodbtype'} = &dbutil::get_default_infodb_type();
    381381    }
    382382    if ($collectcfg->{'infodbtype'} eq "gdbm-txtgz") {
     
    403403    if (!&FileUtils::isFilenameAbsolute($importdir))
    404404    {
    405       $importdir = &FileUtils::filenameConcatenate($ENV{'GSDLCOLLECTDIR'}, $importdir);
     405    $importdir = &FileUtils::filenameConcatenate($ENV{'GSDLCOLLECTDIR'}, $importdir);
    406406    }
    407407    else
    408408    {
    409       # Don't do this - it kills protocol prefixes
    410       #$importdir =~ s/[\\\/]+/\//g;
    411       #$importdir =~ s/\/$//;
    412       # Do this instead
    413       &FileUtils::sanitizePath($importdir);
     409    # Don't do this - it kills protocol prefixes
     410    #$importdir =~ s/[\\\/]+/\//g;
     411    #$importdir =~ s/\/$//;
     412    # Do this instead
     413    &FileUtils::sanitizePath($importdir);
    414414    }
    415415
    416416    if (!&FileUtils::directoryExists($importdir))
    417417    {
    418       &gsprintf($out, "{import.no_import_dir}\n\n", $importdir);
    419       die "\n";
     418    &gsprintf($out, "{import.no_import_dir}\n\n", $importdir);
     419    die "\n";
    420420    }
    421421    $self->{'importdir'} = $importdir;
     
    435435    }
    436436    }
    437  
     437    
    438438    if (defined $collectcfg->{'manifest'} && $self->{'manifest'} eq "") {
    439439    $self->{'manifest'} = $collectcfg->{'manifest'};
     
    452452    }
    453453
    454    
     454    
    455455
    456456    if (defined $self->{'default_OIDtype'} ) {
     
    474474    }
    475475    $self->{'gli'} = 0 unless defined $self->{'gli'};
    476        
     476   
    477477    # check keepold and removeold
    478478    my $checkdir = ($inexport_mode eq "import") ? "archives" : "export";
     
    492492    if ($self->{'manifest'} && (!$keepold || !$incremental))
    493493    {
    494       print STDERR "Warning: -manifest flag should not be specified without also setting -keepold or -incremental\n";
    495     }
    496     }
     494    print STDERR "Warning: -manifest flag should not be specified without also setting -keepold or -incremental\n";
     495    }
     496}
    497497
    498498sub process_files
     
    727727    if ($manifest eq '' || (defined $collectcfg->{'complexmeta'} && $collectcfg->{'complexmeta'} eq 'true'))
    728728    {
    729       &plugin::file_block_read($pluginfo, $importdir, "", $block_hash, $metadata, $gli);
     729    &plugin::file_block_read($pluginfo, $importdir, "", $block_hash, $metadata, $gli);
    730730    }
    731731    else
    732732    {
    733       print STDERR "Skipping global file scan due to manifest and complexmeta configuration\n";
     733    print STDERR "Skipping global file scan due to manifest and complexmeta configuration\n";
    734734    }
    735735
     
    744744    if ($manifest ne "") {
    745745
    746       # mark that we are using a manifest - information that might be needed
    747       # down in plugins (for instance DirectoryPlugin)
    748       $block_hash->{'manifest'} = $self->{'manifest_version'};
     746    # mark that we are using a manifest - information that might be needed
     747    # down in plugins (for instance DirectoryPlugin)
     748    $block_hash->{'manifest'} = $self->{'manifest_version'};
    749749
    750750    #
     
    826826
    827827    my $arcinfo_src_filename = &dbutil::get_infodb_file_path($collectcfg->{'infodbtype'}, "archiveinf-src", $archivedir);
    828       # need to check this file exists before trying to read it - in the past
    829       # it wasn't possible to have a manifest unless keepold was also set so
    830       # you were pretty much guaranteed arcinfo existed
    831       # [jmt12]
    832       # @todo &FileUtils::fileExists($arcinfo_src_filename) [jmt12]
    833       if (-e $arcinfo_src_filename)
    834       {
    835     my $arcinfodb_map = {};
    836     &dbutil::read_infodb_file($collectcfg->{'infodbtype'}, $arcinfo_src_filename, $arcinfodb_map);
    837     foreach my $f (@full_new_files) {
    838         my $rel_f = &util::abspath_to_placeholders($f);
    839 
    840         # check that we haven't seen it already
    841         if (defined $arcinfodb_map->{$rel_f}) {
    842         # TODO make better warning
    843         print STDERR "Warning: $f ($rel_f) already in src archive, \n";
    844         } else {
     828    # need to check this file exists before trying to read it - in the past
     829    # it wasn't possible to have a manifest unless keepold was also set so
     830    # you were pretty much guaranteed arcinfo existed
     831    # [jmt12]
     832    # @todo &FileUtils::fileExists($arcinfo_src_filename) [jmt12]
     833    if (-e $arcinfo_src_filename)
     834    {
     835        my $arcinfodb_map = {};
     836        &dbutil::read_infodb_file($collectcfg->{'infodbtype'}, $arcinfo_src_filename, $arcinfodb_map);
     837        foreach my $f (@full_new_files) {
     838        my $rel_f = &util::abspath_to_placeholders($f);
     839
     840        # check that we haven't seen it already
     841        if (defined $arcinfodb_map->{$rel_f}) {
     842            # TODO make better warning
     843            print STDERR "Warning: $f ($rel_f) already in src archive, \n";
     844        } else {
     845            $block_hash->{'new_files'}->{$f} = 1;
     846        }
     847        }
     848
     849        undef $arcinfodb_map;
     850    }
     851    # no existing files - so we can just add all the files [jmt12]
     852    else
     853    {
     854        foreach my $f (@full_new_files)
     855        {
    845856        $block_hash->{'new_files'}->{$f} = 1;
    846857        }
    847858    }
    848 
    849     undef $arcinfodb_map;
    850       }
    851       # no existing files - so we can just add all the files [jmt12]
    852       else
    853       {
    854         foreach my $f (@full_new_files)
    855         {
    856           $block_hash->{'new_files'}->{$f} = 1;
    857         }
    858       }
    859    
    860       # If we are not using complex inherited metadata (and thus have skipped
    861       # the global file scan) we need to at least check for a matching
    862       # metadata.xml for the files being indexed/reindexed
    863       # - unless we are using the newer version of Manifests, which are treated
    864       #   verbatim, and should have a metadata element for metadata files (so
    865       #   we can explicitly process metadata files other than metadata.xml)
    866       # [jmt12]
    867       if ($self->{'manifest_version'} == 1 && (!defined $collectcfg->{'complexmeta'} || $collectcfg->{'complexmeta'} ne 'true'))
    868       {
    869         my @all_files_to_import = (keys %{$block_hash->{'reindex_files'}}, keys %{$block_hash->{'new_files'}});
    870         foreach my $file_to_import (@all_files_to_import)
    871         {
    872           my $metadata_xml_path = $file_to_import;
    873           $metadata_xml_path =~ s/[^\\\/]*$/metadata.xml/;
    874           if (&FileUtils::fileExists($metadata_xml_path))
    875           {
    876             &plugin::file_block_read($pluginfo, '', $metadata_xml_path, $block_hash, $metadata, $gli);
    877           }
    878         }
    879       }
    880 
    881       # new version manifest files explicitly list metadata files to be
    882       # processed (ignoring complexmeta if set)
    883       # [jmt12]
    884       if ($self->{'manifest_version'} > 1)
    885       {
    886         # Process metadata files
    887         foreach my $file_to_import (keys %{$block_hash->{'reindex_files'}}, keys %{$block_hash->{'new_files'}})
    888         {
    889           $self->perform_process_files($manifest, $pluginfo, '', $file_to_import, $block_hash, $metadata, $processor, $maxdocs);
    890         }
    891       }
     859   
     860    # If we are not using complex inherited metadata (and thus have skipped
     861    # the global file scan) we need to at least check for a matching
     862    # metadata.xml for the files being indexed/reindexed
     863    # - unless we are using the newer version of Manifests, which are treated
     864    #   verbatim, and should have a metadata element for metadata files (so
     865    #   we can explicitly process metadata files other than metadata.xml)
     866    # [jmt12]
     867    if ($self->{'manifest_version'} == 1 && (!defined $collectcfg->{'complexmeta'} || $collectcfg->{'complexmeta'} ne 'true'))
     868    {
     869        my @all_files_to_import = (keys %{$block_hash->{'reindex_files'}}, keys %{$block_hash->{'new_files'}});
     870        foreach my $file_to_import (@all_files_to_import)
     871        {
     872        my $metadata_xml_path = $file_to_import;
     873        $metadata_xml_path =~ s/[^\\\/]*$/metadata.xml/;
     874        if (&FileUtils::fileExists($metadata_xml_path))
     875        {
     876            &plugin::file_block_read($pluginfo, '', $metadata_xml_path, $block_hash, $metadata, $gli);
     877        }
     878        }
     879    }
     880
     881    # new version manifest files explicitly list metadata files to be
     882    # processed (ignoring complexmeta if set)
     883    # [jmt12]
     884    if ($self->{'manifest_version'} > 1)
     885    {
     886        # Process metadata files
     887        foreach my $file_to_import (keys %{$block_hash->{'reindex_files'}}, keys %{$block_hash->{'new_files'}})
     888        {
     889        $self->perform_process_files($manifest, $pluginfo, '', $file_to_import, $block_hash, $metadata, $processor, $maxdocs);
     890        }
     891    }
    892892    } # end if (manifest ne "")
    893893    else {
     
    910910
    911911        if ($incremental) {
    912                # only look for deletions if we are truely incremental
     912        # only look for deletions if we are truely incremental
    913913        my @deleted_files = sort keys %{$block_hash->{'deleted_files'}};
    914914        # Filter out any in gsdl/tmp area
     
    918918        $gsdl_tmp_area = &util::filename_to_regex($gsdl_tmp_area);
    919919        $collect_tmp_area = &util::filename_to_regex($collect_tmp_area);
    920                  
     920       
    921921        foreach my $df (@deleted_files) {
    922922            next if ($df =~ m/^$gsdl_tmp_area/);
     
    932932            print STDERR "Files deleted since last import:\n  ";
    933933            print STDERR join("\n  ",@deleted_files), "\n";
    934        
    935        
     934           
     935           
    936936            &plugin::remove_some($pluginfo, $collectcfg->{'infodbtype'}, $archivedir, \@deleted_files);
    937937           
     
    947947            mark_docs_for_deletion($archive_info,$block_hash,\@reindex_files, $archivedir,$verbosity, "reindex");
    948948        }
    949                
     949       
    950950        }       
    951951    } # end if incremental/only_add mode
     
    961961    my $earliestDatestampFile = &FileUtils::filenameConcatenate($archivedir, "earliestDatestamp");
    962962    if ($self->{'generate_auxiliary_files'}) {
    963     if (!-f $earliestDatestampFile && -d $archivedir) {
    964     my $current_time_in_seconds = time; # in seconds
    965 
    966     if(open(FOUT, ">$earliestDatestampFile")) {
    967         # || (&gsprintf(STDERR, "{common.cannot_open}: $!\n", $earliestDatestampFile) && die);
    968         print FOUT $current_time_in_seconds;
    969         close(FOUT);
    970     }
    971     else {
    972         &gsprintf(STDERR, "{import.cannot_write_earliestdatestamp}\n", $earliestDatestampFile);
    973     }
    974 
    975     }
     963    if (!-f $earliestDatestampFile && -d $archivedir) {
     964        my $current_time_in_seconds = time; # in seconds
     965
     966        if(open(FOUT, ">$earliestDatestampFile")) {
     967        # || (&gsprintf(STDERR, "{common.cannot_open}: $!\n", $earliestDatestampFile) && die);
     968        print FOUT $current_time_in_seconds;
     969        close(FOUT);
     970        }
     971        else {
     972        &gsprintf(STDERR, "{import.cannot_write_earliestdatestamp}\n", $earliestDatestampFile);
     973        }
     974
     975    }
    976976    }
    977977   
     
    10041004    if ($self->{'OIDtype'} eq 'incremental')
    10051005    {
    1006       store_doc_oid_count($archivedir);
     1006    store_doc_oid_count($archivedir);
    10071007    }
    10081008
     
    10111011    $processor->end();
    10121012   
    1013 #    if ($inexport_mode eq "import") {
     1013    #    if ($inexport_mode eq "import") {
    10141014    if ($self->{'generate_auxiliary_files'}) {
    10151015    # write out the archive information file
     
    10331033sub perform_process_files
    10341034{
    1035   my $self = shift(@_);
    1036   my ($manifest, $pluginfo, $importdir, $file_to_import, $block_hash, $metadata, $processor, $maxdocs) = @_;
    1037   my $gli = $self->{'gli'};
    1038   # specific file to process - via manifest version 2+
    1039   if ($file_to_import ne '')
    1040   {
    1041     &plugin::read ($pluginfo, '', $file_to_import, $block_hash, $metadata, $processor, $maxdocs, 0, $gli);
    1042   }
    1043   # global file scan - if we are using a new version manifest, files would have
    1044   # been read above. Older manifests use extra settings in the $block_hash to
    1045   # control what is imported, while non-manifest imports use a regular
    1046   # $block_hash (so obeying process_exp and block_exp) [jmt12]
    1047   elsif ($manifest eq '' || $self->{'manifest_version'} == 1)
    1048   {
    1049     &plugin::read ($pluginfo, $importdir, '', $block_hash, $metadata, $processor, $maxdocs, 0, $gli);
    1050   }
    1051   else
    1052   {
    1053     print STDERR "Skipping perform_process_files() due to manifest presence and version\n";
    1054   }
     1035    my $self = shift(@_);
     1036    my ($manifest, $pluginfo, $importdir, $file_to_import, $block_hash, $metadata, $processor, $maxdocs) = @_;
     1037    my $gli = $self->{'gli'};
     1038    # specific file to process - via manifest version 2+
     1039    if ($file_to_import ne '')
     1040    {
     1041    &plugin::read ($pluginfo, '', $file_to_import, $block_hash, $metadata, $processor, $maxdocs, 0, $gli);
     1042    }
     1043    # global file scan - if we are using a new version manifest, files would have
     1044    # been read above. Older manifests use extra settings in the $block_hash to
     1045    # control what is imported, while non-manifest imports use a regular
     1046    # $block_hash (so obeying process_exp and block_exp) [jmt12]
     1047    elsif ($manifest eq '' || $self->{'manifest_version'} == 1)
     1048    {
     1049    &plugin::read ($pluginfo, $importdir, '', $block_hash, $metadata, $processor, $maxdocs, 0, $gli);
     1050    }
     1051    else
     1052    {
     1053    print STDERR "Skipping perform_process_files() due to manifest presence and version\n";
     1054    }
    10551055}
    10561056# perform_process_files()
     
    10591059sub generate_statistics
    10601060{
    1061   my $self = shift @_;
    1062   my ($pluginfo) = @_;
    1063 
    1064   my $inexport_mode = $self->{'mode'};
    1065   my $out           = $self->{'out'};
    1066   my $faillogname   = $self->{'faillogname'};
    1067   my $statsfile     = $self->{'statsfile'};
    1068   my $gli           = $self->{'gli'};
    1069 
    1070   &gsprintf($out, "\n");
    1071   &gsprintf($out, "*********************************************\n");
    1072   &gsprintf($out, "{$inexport_mode.complete}\n");
    1073   &gsprintf($out, "*********************************************\n");
    1074 
    1075   &plugin::write_stats($pluginfo, $statsfile, $faillogname, $gli);
     1061    my $self = shift @_;
     1062    my ($pluginfo) = @_;
     1063
     1064    my $inexport_mode = $self->{'mode'};
     1065    my $out           = $self->{'out'};
     1066    my $faillogname   = $self->{'faillogname'};
     1067    my $statsfile     = $self->{'statsfile'};
     1068    my $gli           = $self->{'gli'};
     1069
     1070    &gsprintf($out, "\n");
     1071    &gsprintf($out, "*********************************************\n");
     1072    &gsprintf($out, "{$inexport_mode.complete}\n");
     1073    &gsprintf($out, "*********************************************\n");
     1074
     1075    &plugin::write_stats($pluginfo, $statsfile, $faillogname, $gli);
    10761076}
    10771077# generate_statistics()
     
    10831083sub deinit
    10841084{
    1085   my $self = shift(@_);
    1086   close OUT if $self->{'close_out'};
    1087   close FAILLOG if $self->{'close_faillog'};
    1088   close STATSFILE if $self->{'close_statsfile'};
     1085    my $self = shift(@_);
     1086    close OUT if $self->{'close_out'};
     1087    close FAILLOG if $self->{'close_faillog'};
     1088    close STATSFILE if $self->{'close_statsfile'};
    10891089}
    10901090# deinit()
     
    11671167    if (open(OIDOUT,">$oid_count_filename")) {
    11681168    print OIDOUT $doc::OIDcount, "\n";
    1169        
     1169   
    11701170    close(OIDOUT);
    11711171    }
     
    11971197
    11981198    foreach my $prev_file (keys %$prev_all_files) {
    1199         # arcinfo deals in real filenames ie windows short names. but the block hash stuff is all full long versions.
     1199    # arcinfo deals in real filenames ie windows short names. but the block hash stuff is all full long versions.
    12001200    $prev_file = &util::upgrade_if_dos_filename($prev_file);
    12011201   
     
    12141214    # there any more => mark them for deletion
    12151215    foreach my $curr_file (keys %{$block_hash->{'all_files'}}) {
    1216      
     1216   
    12171217    my $full_curr_file = $curr_file;
    12181218
     
    12991299
    13001300    foreach my $existing_f (keys %{$block_hash->{'existing_files'}}) {
    1301    
     1301       
    13021302        if ($existing_f =~ m/^$situated_dir/) {
    13031303
    1304 #       print STDERR "**** Existing file $existing_f\nis located within\n$situated_dir\n";
     1304        #       print STDERR "**** Existing file $existing_f\nis located within\n$situated_dir\n";
    13051305
    13061306        push(@$reindex_files,$existing_f);
     
    13671367
    13681368      if (!-e $full_curr_file) {
    1369             $curr_file = &util::upgrade_if_dos_filename($curr_file);
     1369          $curr_file = &util::upgrade_if_dos_filename($curr_file);
    13701370          $block_hash->{'deleted_files'}->{$curr_file} = 1;
    13711371      }
    1372       } @deleted_files;
     1372    } @deleted_files;
    13731373
    13741374
     
    14041404    $archive_info->remove_reverseinfo($downgraded_file);
    14051405   
    1406     foreach my $oid (@$oids) {
     1406    foreach my $oid (@$oids) {
    14071407        # get the record for this OID from doc db
    14081408        my $doc_rec = &dbutil::read_infodb_entry($infodbtype, $arcinfo_doc_filename, $oid);
     
    14301430            if (!defined $archive_info->get_reverseinfo($assocfile)) {
    14311431            # nothing refers to it anymore, mark for reindex.
    1432                 # block hash needs full filenames
    1433                 $assocfile =  &util::upgrade_if_dos_filename($assocfile);
     1432            # block hash needs full filenames
     1433            $assocfile =  &util::upgrade_if_dos_filename($assocfile);
    14341434            $block_hash->{'reindex_files'}->{$assocfile} = 1;
    14351435            }
     
    14761476
    14771477    my ($dirname, $list) = @_;
    1478  
     1478    
    14791479    # Recur over directory contents.
    14801480    my (@dir, $subfile);
     
    14991499    }
    15001500    }
    1501    
     1501   
    15021502}
    15031503
    1504    
     1504
    150515051;
Note: See TracChangeset for help on using the changeset viewer.