Changeset 23939 for main/trunk
- Timestamp:
- 2011-04-20T21:27:19+12:00 (13 years ago)
- Location:
- main/trunk/greenstone2/perllib
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/basebuilder.pm
r23172 r23939 560 560 561 561 $build_cfg->{'infodbtype'} = $self->{'infodbtype'}; 562 563 # write out the earliestDatestamp information needed for OAI 564 my $archivedir = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "archives"); 565 if(!-d $archivedir) { 566 $archivedir = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "export"); 567 } 568 if(-d $archivedir) { 569 my $earliestDatestampFile = &util::filename_cat ($archivedir, "earliestDatestamp"); 570 open(FIN,"<$earliestDatestampFile") || die "{common.cannot_open} $earliestDatestampFile: $!\n"; 571 my $earliestDatestamp; 572 { 573 # slurp in file as a single line 574 local $/ = undef; 575 $earliestDatestamp = <FIN>; 576 #&unicode::ensure_utf8(\$earliestDatestamp); # turn any high bytes that aren't valid utf-8 into utf-8. 577 } 578 close(FIN); 579 $build_cfg->{'earliestDatestamp'} = $earliestDatestamp; 580 } 562 581 563 582 $self->build_cfg_extra($build_cfg); -
main/trunk/greenstone2/perllib/buildConfigxml.pm
r23895 r23939 226 226 &write_line('COLCFG', ["<metadata name=\"infodbType\">", $buildcfg->{"infodbtype"}, "</metadata>"]); 227 227 } 228 if (defined $buildcfg->{'earliestDatestamp'}) { 229 &write_line('COLCFG', ["<metadata name=\"earliestDatestamp\">", $buildcfg->{"earliestDatestamp"}, "</metadata>"]); 230 } 231 228 232 &write_line('COLCFG', ["</metadataList>"]); 229 233 -
main/trunk/greenstone2/perllib/colcfg.pm
r21785 r23939 225 225 226 226 return &cfgread::read_cfg_file ($filename, 227 q/^( infodbtype|builddate|buildtype|numdocs|numsections|numwords|numbytes|maxnumeric|textlevel|indexstem|stemindexes|separate_cjk)$/,227 q/^(earliestdatestamp|infodbtype|builddate|buildtype|numdocs|numsections|numwords|numbytes|maxnumeric|textlevel|indexstem|stemindexes|separate_cjk)$/, 228 228 q/^(indexmap|subcollectionmap|languagemap|notbuilt|indexfields|indexfieldmap|indexlevels|levelmap)$/); 229 229 … … 235 235 236 236 &cfgread::write_cfg_file($filename, $data, 237 q/^( infodbtype|builddate|buildtype|numdocs|numsections|numwords|numbytes|maxnumeric|textlevel|indexstem|stemindexes|separate_cjk)$/,237 q/^(earliestdatestamp|infodbtype|builddate|buildtype|numdocs|numsections|numwords|numbytes|maxnumeric|textlevel|indexstem|stemindexes|separate_cjk)$/, 238 238 q/^(indexmap|subcollectionmap|languagemap|notbuilt|indexfields|indexfieldmap|indexlevels|levelmap)$/); 239 239 } -
main/trunk/greenstone2/perllib/doc.pm
r23923 r23939 126 126 127 127 # set lastmodified for OAI purposes, added by GRB, moved by kjdon 128 sub set_oailastmodified { 129 my $self = shift (@_); 130 131 my $source_path = $self->{'terse_source_path'}; 132 133 if (defined $source_path && (-e $source_path)) { 134 my $current_time = time; 135 136 my ($seconds, $minutes, $hours, $day_of_month, $month, $year, 137 $wday, $yday, $isdst) = localtime($current_time); 138 139 my $date_modified = sprintf("%d%02d%02d",1900+$year,$month+1,$day_of_month); 140 141 $self->add_utf8_metadata($self->get_top_section(), "oailastmodified", $current_time); 142 $self->add_utf8_metadata($self->get_top_section(), "oailastmodifieddate", $date_modified); 143 } 144 } 145 146 # no longer used for OAI purposes, since lastmodified is not what we want as the 147 # Datestamp of a document. This doc metadata may be useful for general purposes. 128 148 sub set_lastmodified { 129 149 my $self = shift (@_); -
main/trunk/greenstone2/perllib/inexport.pm
r23825 r23939 708 708 } 709 709 } 710 710 711 # Check for existence of the file that's to contain earliestDateStamp in archivesdir 712 # Do nothing if the file already exists (file exists on incremental build). 713 # If the file doesn't exist, as happens on full build, create it and write out the current datestamp into it 714 # In buildcol, read the file's contents and set the earliestdateStamp in GS2's build.cfg / GS3's buildconfig.xml 715 # In doc.pm have set_oaiLastModified similar to set_lastmodified, and create the doc fields 716 # oailastmodified and oailastmodifieddate 717 my $earliestDatestampFile = &util::filename_cat($archivedir, "earliestDatestamp"); 718 if (!-f $earliestDatestampFile) { 719 my $current_time_in_seconds = time; # in seconds 720 open(FOUT, ">$earliestDatestampFile") || die "{common.cannot_open} $earliestDatestampFile: $!\n"; 721 # (&gsprintf(STDERR, "{common.cannot_open}: $!\n", $earliestDatestampFile) && die); 722 print FOUT $current_time_in_seconds; 723 close(FOUT); 724 } 725 711 726 # now, whichever mode we are in, we can process the entire import folder 712 727 if ((defined $jobs) && ($jobs > 1)) -
main/trunk/greenstone2/perllib/plugouts/BasePlugout.pm
r23824 r23939 424 424 my ($doc_obj) = @_; 425 425 426 # for OAI purposes 426 427 $doc_obj->set_lastmodified(); 428 $doc_obj->set_oailastmodified(); 427 429 428 430 if ($self->{'group_size'} > 1) {
Note:
See TracChangeset
for help on using the changeset viewer.