Changeset 28001

Show
Ignore:
Timestamp:
08.08.2013 12:46:06 (6 years ago)
Author:
jmt12
Message:

Write datestamp using dbutil if applicable

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gs2-extensions/parallel-building/trunk/src/perllib/parallelbuildinginexport.pm

    r27995 r28001  
    3030package parallelbuildinginexport; 
    3131 
     32# Pragma 
    3233use strict; 
     34no strict 'refs'; # allow filehandles to be variables and vice versa 
     35no strict 'subs'; # allow barewords (eg STDERR) as function arguments 
    3336 
    3437# MODULES 
     
    308311## generate_statistics() ## 
    309312 
     313 
     314## @function recordEarliestDatestamp() 
     315# 
     316# Check for existence of the file that's to contain earliestDateStamp in 
     317# archivesdir Do nothing if the file already exists (file exists on incremental 
     318# build).  If the file doesn't exist, as happens on full build, create it and 
     319# write out the current datestamp into it In buildcol, read the file's contents 
     320# and set the earliestdateStamp in GS2's build.cfg / GS3's buildconfig.xml In 
     321# doc.pm have set_oaiLastModified similar to set_lastmodified, and create the 
     322# doc fields oailastmodified and oailastmodifieddate 
     323# 
     324sub recordEarliestDatestamp 
     325{ 
     326  my $self = shift(@_); 
     327  my ($infodbtype, $archivedir) = @_; 
     328  my $current_time_in_seconds = time; # in seconds 
     329  # We use the infodb to store this information if it supports it 
     330  if (defined(&dbutil::supportsDatestamp) && &dbutil::supportsDatestamp($infodbtype)) 
     331  { 
     332    my $datestamp_db = &dbutil::get_infodb_file_path($infodbtype, 'datestamp', $archivedir); 
     333    my $datestamp_db_fh = &dbutil::open_infodb_write_handle($infodbtype, $datestamp_db, 'append'); 
     334    &dbutil::write_infodb_rawentry($infodbtype, $datestamp_db_fh, 'earliest', $current_time_in_seconds); 
     335    &dbutil::close_infodb_write_handle($infodbtype, $datestamp_db_fh); 
     336  } 
     337  else 
     338  { 
     339    my $earliestDatestampFile = &FileUtils::filenameConcatenate($archivedir, "earliestDatestamp"); 
     340    if (!&FileUtils::fileExists($earliestDatestampFile) && &FileUtils::directoryExists($archivedir)) 
     341    { 
     342      my $datestamp_fh; 
     343      if(&FileUtils::openFileHandle($earliestDatestampFile, 'w', \$datestamp_fh)) 
     344      { 
     345        print $datestamp_fh $current_time_in_seconds; 
     346        &FileUtils::closeFileHandle($earliestDatestampFile, \$datestamp_fh); 
     347      } 
     348      else 
     349      { 
     350        &gsprintf(STDERR, "{import.cannot_write_earliestdatestamp}\n", $earliestDatestampFile); 
     351      } 
     352    } 
     353  } 
     354} 
     355## recordEarliestDatestamp() ## 
     356 
    3103571;