Changeset 32615 for main/trunk
- Timestamp:
- 2018-11-20T10:54:07+13:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/inexport.pm
r32586 r32615 628 628 my $archive_info = new arcinfo ($collectcfg->{'infodbtype'}); 629 629 $archive_info->load_info ($arcinfo_doc_filename); 630 # load in rev info so we don't overwrite existing info when we do incremental import 631 # from here on, make all changes to this object, then write out the file at the end. 632 $archive_info->load_rev_info($arcinfo_src_filename); 630 633 631 634 if ($manifest eq "") { … … 713 716 $block_hash->{'metadata_files'} = {}; 714 717 $block_hash->{'shared_fileroot'} = ''; 715 # a new flag so we can tell we had a manifest way down in the plugins716 # [jmt12]717 718 $block_hash->{'manifest'} = 'false'; 718 719 my $metadata = {}; … … 855 856 } 856 857 } 857 858 858 859 # If we are not using complex inherited metadata (and thus have skipped 859 860 # the global file scan) we need to at least check for a matching … … 1374 1375 1375 1376 1376 # this is used to delete "deleted" docs ,and to remove old versions of "changed" docs1377 # this is used to delete "deleted" docs and to remove old versions of "changed" docs 1377 1378 # $mode is 'delete' or 'reindex' 1378 1379 sub mark_docs_for_deletion … … 1396 1397 # use 'archiveinf-src' info database file to look up all the OIDs 1397 1398 # that this file is used in (note in most cases, it's just one OID) 1398 1399 my $relfile = &util::abspath_to_placeholders($file); 1400 1401 my $src_rec = &dbutil::read_infodb_entry($infodbtype, $arcinfo_src_filename, $relfile); 1402 my $oids = $src_rec->{'oid'}; 1403 my $file_record_deleted = 0; 1404 1405 # delete the src record 1406 my $src_infodb_file_handle = &dbutil::open_infodb_write_handle($infodbtype, $arcinfo_src_filename, "append"); 1407 &dbutil::delete_infodb_entry($infodbtype, $src_infodb_file_handle, $relfile); 1408 &dbutil::close_infodb_write_handle($infodbtype, $src_infodb_file_handle); 1409 1410 1411 foreach my $oid (@$oids) { 1412 1399 ); 1400 my $oids = $archive_info->get_reverseinfo($file); 1401 $archive_info->remove_reverseinfo($file); 1402 1403 foreach my $oid (@$oids) { 1404 # get the record for this OID from doc db 1405 my $doc_rec = &dbutil::read_infodb_entry($infodbtype, $arcinfo_doc_filename, $oid); 1413 1406 # find the source doc (the primary file that becomes this oid) 1414 my $doc_rec = &dbutil::read_infodb_entry($infodbtype, $arcinfo_doc_filename, $oid);1415 1407 my $doc_source_file = $doc_rec->{'src-file'}->[0]; 1416 1408 $doc_source_file = &util::placeholders_to_abspath($doc_source_file); … … 1426 1418 $block_hash->{'reindex_files'}->{$doc_source_file} = 1; 1427 1419 1420 } else { 1421 1422 # the file to be deleted/reindexed is a primary file. We need to remove all references to this in the src db 1423 my $assoc_files = $doc_rec->{'assoc-file'}; 1424 foreach my $assocfile (@$assoc_files) { 1425 $assocfile = &util::placeholders_to_abspath($assocfile); 1426 $archive_info->remove_reverseinfo($assocfile, $oid); 1427 if (!defined $archive_info->get_reverseinfo($assocfile)) { 1428 # nothing refers to it anymore, mark for reindex. 1429 $block_hash->{'reindex_files'}->{$assocfile} = 1; 1430 } 1431 } 1432 1428 1433 } 1429 1434 my $curr_status = $archive_info->get_status_info($oid);
Note:
See TracChangeset
for help on using the changeset viewer.