Ignore:
Timestamp:
2013-09-12T10:10:44+12:00 (11 years ago)
Author:
davidb
Message:

This action now saves the newly created document in the same archives folder as the original, and update the archivesinf-doc database appropriately

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/cgiactions/docextractaction.pm

    r28251 r28261  
    358358    # look up additional args
    359359    my $docid = $self->{'d'};
    360     my $new_docid = $self->{'newd'} || "HASH" . localtime(time);
     360
     361    my $timestamp = time();
     362    my $new_docid = $self->{'newd'} || "HASH$timestamp";
    361363
    362364    $self->{'keep-parent-metadata'} = $self->parse_flag("keep-parent-metadata");
     
    373375    my $doc_filename = &util::filename_cat($archive_dir, $doc_file);
    374376
    375     my $newdoc_filename = &util::filename_cat($archive_dir, "test.xml");
    376 
    377 #   # This now stores the full pathname
    378 #   my $doc_filename = $doc_rec->{'doc-file'}->[0];
     377    my $new_doc_file = $doc_file;
     378    $new_doc_file =~ s/doc(-\d+)?.xml$/doc-$timestamp.xml/;
     379
     380    my $newdoc_filename = &util::filename_cat($archive_dir, $new_doc_file);
    379381
    380382    my $sec_num_hash = $self->sections_as_hash($json_sections_array);
     
    390392
    391393        if ($delete_status == 0) {
     394
     395        # Existing doc record needs to be reindexed
     396        $doc_rec->{'index-status'} = ["I"];
     397        &dbutil::set_infodb_entry($infodbtype, $arcinfo_doc_filename, $docid, $doc_rec);
     398
     399        # Create doc-record entry for the newly extracted document
     400
     401        my $new_doc_rec = $doc_rec;
     402        #### Need to cut this down to just the assoc files the new document references
     403
     404        &dbutil::set_infodb_entry($infodbtype, $arcinfo_doc_filename, $new_docid, $new_doc_rec);
     405
     406        #### Also need to update the archivesinf-src database!!!!
     407        # For all the assoc and src files, retrieve record, and add in new_docid
    392408
    393409        my $mess = "document-extract successful: Key[$docid]\n";
Note: See TracChangeset for help on using the changeset viewer.