Ignore:
Timestamp:
2010-10-20T13:12:24+13:00 (14 years ago)
Author:
kjdon
Message:

fixed up bug with deleting assoc files. Was fine for a delete, but for an update, need to delete the old ones *before* adding the new ones. And also, don't delete the lucene text doc when updating. Presumably it has already been overwritten with the correct version

File:
1 edited

Legend:

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

    r23176 r23182  
    406406    $archivedir = $dir;
    407407
     408    if ($edit_mode eq "delete") {
     409        # record this doc so we don't process the reconstructed doc later
     410        $self->{'dont_process_reconstructed'}->{$doc_obj->get_OID()} = 1;
     411        # we don't need to do anything else for the info database for a deleted document. The infodb starts from scratch each time, so no deletion is necessary
     412        $self->delete_assoc_files ($archivedir, "delete");
     413        return;
     414    }
     415    if ($edit_mode eq "update") {
     416        # we don't want to process the reconstructed doc later, but we will process this version now.
     417        $self->{'dont_process_reconstructed'}->{$doc_obj->get_OID()} = 1;
     418        # delete the old assoc files as they may have changed
     419        $self->delete_assoc_files ($archivedir, "update");
     420    }
     421   
    408422    # resolve the final filenames of the files associated with this document
     423    # now save the new assoc files for an update/new doc.
    409424    $self->assoc_files ($doc_obj, $archivedir);
    410425    }
     
    414429    my $top_section = $doc_obj->get_top_section();
    415430    $archivedir = $doc_obj->get_metadata_element($top_section,"archivedir");
    416     }
    417 
    418     if ($edit_mode eq "delete") {
    419     # record this doc so we don't process the reconstructed doc later
    420     $self->{'dont_process_reconstructed'}->{$doc_obj->get_OID()} = 1;
    421     # we don't need to do anything else for the info database for a deleted document. The infodb starts from scratch each time, so no deletion is necessary
    422     $self->delete_assoc_files ($archivedir);
    423     return;
    424     }
    425    
    426     if ($edit_mode eq "update") {
    427     # we don't want to process the reconstructed doc later, but we will process this version now.
    428     $self->{'dont_process_reconstructed'}->{$doc_obj->get_OID()} = 1;
    429     $self->delete_assoc_files ($archivedir);
    430431    }
    431432
     
    819820{
    820821    my $self = shift (@_);
    821     my ($archivedir) = @_;
     822    my ($archivedir, $edit_mode) = @_;
    822823
    823824    my $assoc_dir = &util::filename_cat($self->{'assocdir'}, $archivedir);
Note: See TracChangeset for help on using the changeset viewer.