Changeset 16252 for gsdl


Ignore:
Timestamp:
2008-06-30T16:13:08+12:00 (16 years ago)
Author:
mdewsnip
Message:

Fixes to get_doc_dir() and get_new_doc_dir() so if you are importing the same document multiple times it doesn't generate a new archives directory with another ".dir" at the end every time.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/plugouts/BasPlugout.pm

    r15140 r16252  
    517517    my $doc_dir = '';
    518518
    519     if (defined $doc_info && scalar(@$doc_info) >= 1) {
    520     # this OID already has an assigned directory, use the
    521     # same one.
     519    if (defined $doc_info && scalar(@$doc_info) >= 1)
     520    {
     521    # This OID already has an archives directory, so use it again
    522522    $doc_dir = $doc_info->[0];
    523523    $doc_dir =~ s/\/?((doc(mets)?)|(dublin_core))\.xml(\.gz)?$//;
    524     } elsif ($self->{'keep_import_structure'}) {
     524    }
     525    elsif ($self->{'keep_import_structure'})
     526    {
    525527    $source_filename = &File::Basename::dirname($source_filename);
    526528    $source_filename =~ s/[\\\/]+/\//g;
     
    528530
    529531        $doc_dir = substr($source_filename, length($ENV{'GSDLIMPORTDIR'}) + 1);
    530 
    531     }
    532 
    533     # have to get a new document directory
    534     $doc_dir = $self->get_new_doc_dir($working_info,$working_dir,$OID) unless $doc_dir ne "";
    535 
    536     $doc_dir .= ".dir";
     532    }
     533
     534    # We have to use a new archives directory for this document
     535    if ($doc_dir eq "")
     536    {
     537    $doc_dir = $self->get_new_doc_dir ($working_info, $working_dir, $OID);
     538    }
     539
    537540    if (!defined $self->{'group'} || !$self->{'group'}){
    538541    &util::mk_all_dir (&util::filename_cat ($working_dir, $doc_dir));
    539542    }
     543
    540544    return $doc_dir;
    541545}
     
    559563         ($working_info->size() >= 1024 && $doc_dir_num < 2)));
    560564   
    561    
    562    return $doc_dir;
     565   return "$doc_dir.dir";
    563566}
    564567
Note: See TracChangeset for help on using the changeset viewer.