Changeset 37194
- Timestamp:
- 2023-01-28T19:01:43+13:00 (15 months ago)
- Location:
- main/trunk/greenstone2/perllib
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/DocHistoryFileUtils.pm
r37187 r37194 379 379 380 380 381 sub doc_copy_archivedir_keepold_to_archivedir 382 { 383 384 my ($keepold_doc_dirname,$doc_dirname) = @_; 385 386 my $status_ok = &FileUtils::hardlinkFilesRefRecursive([$keepold_doc_dirname],$doc_dirname, { 'strict' => 1 } ); 387 388 if (!$status_ok) { 389 print STDERR "Error: Failed to recursively hardlink copy the top-level 'keepold_archives' doc to 'archives'\n"; 390 } 391 392 if (!$status_ok) { 393 print STDERR "\n"; 394 print STDERR "**** A critical error occurred in creating/updating file-level document-version history\n"; 395 print STDERR "**** After determining and correcting the cause of the error, to reset, delete\n"; 396 print STDERR "**** your 'archives' folder, and move 'archives_keep' back to 'archives'\n"; 397 print STDERR "\n"; 398 exit 1; 399 } 400 } 401 381 402 382 403 sub archivedir_keepold_to_archivedir … … 385 406 386 407 # Action Step 5 (from inexport.pm) 387 388 # 5.1 a keepold doc's '_fldv_history' goes first 389 # 5.2 then the keepold doc's top-level content for new 'nminus 1' 408 409 # If needing to turn content in 'archives_keep' into a doc's 'archive' fldv_history/ directory, then 410 # 5.1 a keepold doc's '_fldv_history' goes first 411 # 5.2 then the keepold doc's top-level content for new 'nminus 1' 390 412 391 413 my $perform_firsttime_init = 1; … … 446 468 # **** Need additional work if -groupsize option > 1 is to be supported! 447 469 # **** otherwise need to have earlier test to prevent -groupsize > 1 from been used with fldv-history 448 470 471 my $keepold_doc_filename = &FileUtils::filenameConcatenate($archivedir_keepold, $keepold_doc_file); 472 my $keepold_doc_dirname = &util::get_parent_folder($keepold_doc_filename); 473 474 my $doc_filename = &FileUtils::filenameConcatenate($archivedir, $doc_file); 475 my $doc_dirname = &util::get_parent_folder($doc_filename); 476 449 477 if ($index_status eq "D") { 450 478 # 451 479 # (1) if archive_info entry marked for deletion (D) 452 # 480 # 481 482 # Even though delete is the ultimate outcome for this doc/dir, due to moving 'archives' to 'archives_keep' at the very start of import.pl 483 # we need to recursively hardlink copy it back, so the rest of the incremental import.pl process can work as expected 484 doc_copy_archivedir_keepold_to_archivedir($keepold_doc_dirname,$doc_dirname); 485 453 486 print STDERR " The latest version of $keepold_OID is marked for deletion\n"; 454 487 print STDERR " => nothing to do right now (will be deleted when buildcol.pl run)\n"; 455 488 } 456 489 else { 457 my $keepold_doc_filename = &FileUtils::filenameConcatenate($archivedir_keepold, $keepold_doc_file);458 my $keepold_doc_dirname = &util::get_parent_folder($keepold_doc_filename);459 460 my $doc_filename = &FileUtils::filenameConcatenate($archivedir, $doc_file);461 my $doc_dirname = &util::get_parent_folder($doc_filename);462 463 490 if ($keepold) { 464 491 # … … 482 509 } 483 510 elsif ($index_status eq "B") { 511 # This doc's archive doc folder hasn't change, but due to moving 'archives' to 'archives_keep' at the very start of import.pl 512 # we need to recursively hardlink copy it back 513 514 doc_copy_archivedir_keepold_to_archivedir($keepold_doc_dirname,$doc_dirname); 515 484 516 if ($incremental_mode ne "all") { 485 517 print STDERR " Unchanged version of document in 'archives/' (Index-Status=B)\n"; -
main/trunk/greenstone2/perllib/FileUtils.pm
r37187 r37194 33 33 34 34 use FileHandle; 35 use File::stat; 35 36 36 37 # Greenstone modules … … 72 73 73 74 #canRead 75 #getTimestamp 74 76 #isSymbolicLink 75 77 #modificationTime … … 106 108 107 109 110 ## @function getTimestamp() 111 # 112 sub getTimestamp 113 { 114 my ($filename) = @_; 115 116 my $file_stat = stat($filename); 117 my $mtime = $file_stat->mtime; 118 119 return $mtime; 120 } 121 ## getTimestamp() 122 108 123 ## @function closeFileHandle 109 124 # -
main/trunk/greenstone2/perllib/arcinfo.pm
r37187 r37194 123 123 124 124 my ($cpackage,$cfilename,$cline,$csubr,$chas_args,$cwantarray) = caller(1); 125 print STDERR "\n\n!!!!!!!!!!!! load_info() -- Calling method: $cfilename:$cline $cpackage->$csubr\n\n";126 125 127 126 $self->{'info'} = {}; … … 361 360 my $self = shift (@_); 362 361 my ($arcinfo_doc_filename) = @_; 363 print STDERR "\n\n!!!!!!!!!! SAVE save_arcinfo_doc_timestamp()\n\n";364 362 365 363 my $arcinfo_timestamp_filename = $self->get_timestamp_filename($arcinfo_doc_filename); -
main/trunk/greenstone2/perllib/inexport.pm
r37187 r37194 715 715 } 716 716 717 print STDERR "\n\n\n"; 718 print STDERR "*****!!!!! No easy way in perl to perform file copy and perserve timestamps\n"; 719 print STDERR "*****!!!!! SO => need to implement file with timestamp within (and DBinfo type for good measure)\n"; 720 print STDERR "*****!!!!! and change plugin/incremental building that depends on/uses -M \n"; 721 # ArchiveInfoPlugin, DirectoryPlugin inexport.pm, arcinfo.pma 722 # DirectoryPlugin inexport.pm, arcinfo.pm (convertutil.pm OK, as working on the two files passed to it) 723 print STDERR "\n\n\n"; 724 } 725 726 717 if ($self->{'groupsize'} > 1) { 718 print STDERR "\n"; 719 print STDERR "******\n"; 720 print STDERR "Warning: Minus option '-groupsize' has not been tested with file-level document version history!\n"; 721 print STDERR " If the groups formed between subsequent invocations of import.pl stay the same, then\n"; 722 print STDERR " the formation of file-level document-version history 'nminus-<n> bundles' in _fldv_history directories\n"; 723 print STDERR " should remain correct\n"; 724 print STDERR "******\n"; 725 print STDERR "\n"; 726 } 727 } 728 729 727 730 # Read the archive information file 728 731 # coincidentally fldv-history: Action Step 4 … … 1338 1341 my $arcinfo_doc_filename = &dbutil::get_infodb_file_path($infodbtype, "archiveinf-doc", $archivedir); 1339 1342 1340 #my $archiveinf_timestamp = -M $arcinfo_doc_filename;1341 1343 my ($unused_infodbtype,$archiveinf_timestamp) = $archive_info->load_timestamp($arcinfo_doc_filename); 1342 1344 1343 1345 # First convert all files to absolute form 1344 1346 # This is to support the situation where the import folder is not … … 1387 1389 if ($block_hash->{'metadata_files'}->{$full_curr_file}) { 1388 1390 # is it modified?? 1389 if (-M $full_curr_file < $archiveinf_timestamp) { 1391 my $full_curr_file_timestamp = &FileUtils::getTimestamp($full_curr_file); 1392 1393 if ($full_curr_file_timestamp > $archiveinf_timestamp) { 1390 1394 print STDERR "*** Detected a *modified metadata* file: $full_curr_file\n" if $verbosity >= 2; 1391 1395 # its newer than last build … … 1478 1482 1479 1483 foreach my $existing_filename (@existing_files) { 1480 if (-M $existing_filename < $archiveinf_timestamp) { 1484 my $existing_filename_timestamp = &FileUtils::getTimestamp($existing_filename); 1485 if ($existing_filename_timestamp > $archiveinf_timestamp) { 1481 1486 # file is newer than last build 1482 1487 -
main/trunk/greenstone2/perllib/plugins/DirectoryPlugin.pm
r37187 r37194 141 141 my $archive_info = new arcinfo($infodbtype); 142 142 my ($unused_infodbtype,$archiveinf_timestamp) = $archive_info->load_timestamp($arcinfo_doc_filename); 143 144 # $self->{'inf_timestamp'} = -M $archives_inf;145 143 $self->{'inf_timestamp'} = $archiveinf_timestamp; 146 144 }
Note:
See TracChangeset
for help on using the changeset viewer.