--- loncom/metadata_database/searchcat.pl 2004/06/17 19:37:08 1.58 +++ loncom/metadata_database/searchcat.pl 2005/03/09 18:22:19 1.61 @@ -2,7 +2,7 @@ # The LearningOnline Network # searchcat.pl "Search Catalog" batch script # -# $Id: searchcat.pl,v 1.58 2004/06/17 19:37:08 www Exp $ +# $Id: searchcat.pl,v 1.61 2005/03/09 18:22:19 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -119,7 +119,7 @@ if (defined($oneuser)) { ## ## Use variables for table names so we can test this routine a little easier my $oldname = 'metadata'; -my $newname = 'newmetadata'; +my $newname = 'newmetadata'.$$; # append pid to have unique temporary table # # Read loncapa_apache.conf and loncapa.conf @@ -142,7 +142,7 @@ if ($wwwid!=$<) { } # # Let people know we are running -open(LOG,'>'.$perlvar{'lonDaemons'}.'/logs/searchcat.log'); +open(LOG,'>>'.$perlvar{'lonDaemons'}.'/logs/searchcat.log'); &log(0,'==== Searchcat Run '.localtime()."===="); @@ -321,8 +321,9 @@ sub process_meta_file { my $ref=&metadata($filename); # # $url is the original file url, not the metadata file - my $url='/res/'.&declutter($filename); - $url=~s/\.meta$//; + my $target = $filename; + $target =~ s/\.meta$//; + my $url='/res/'.&declutter($target); &log(3," ".$url) if ($debug); # # Ignore some files based on their metadata @@ -347,6 +348,14 @@ sub process_meta_file { &count_type($url); } # + if (! defined($ref->{'creationdate'}) || + $ref->{'creationdate'} =~ /^\s*$/) { + $ref->{'creationdate'} = (stat($target))[9]; + } + if (! defined($ref->{'lastrevisiondate'}) || + $ref->{'lastrevisiondate'} =~ /^\s*$/) { + $ref->{'lastrevisiondate'} = (stat($target))[9]; + } $ref->{'creationdate'} = &sqltime($ref->{'creationdate'}); $ref->{'lastrevisiondate'} = &sqltime($ref->{'lastrevisiondate'}); my %Data = (