[LON-CAPA-cvs] cvs: loncom /metadata_database searchcat.pl
matthew
lon-capa-cvs@mail.lon-capa.org
Wed, 09 Mar 2005 18:22:19 -0000
matthew Wed Mar 9 13:22:19 2005 EDT
Modified files:
/loncom/metadata_database searchcat.pl
Log:
&process_meta_file: If the creationdate and/or lastrevisiondate is not given
in the .meta file, use the last modified time for the target resource.
Index: loncom/metadata_database/searchcat.pl
diff -u loncom/metadata_database/searchcat.pl:1.60 loncom/metadata_database/searchcat.pl:1.61
--- loncom/metadata_database/searchcat.pl:1.60 Mon Aug 30 10:31:42 2004
+++ loncom/metadata_database/searchcat.pl Wed Mar 9 13:22:19 2005
@@ -2,7 +2,7 @@
# The LearningOnline Network
# searchcat.pl "Search Catalog" batch script
#
-# $Id: searchcat.pl,v 1.60 2004/08/30 14:31:42 matthew Exp $
+# $Id: searchcat.pl,v 1.61 2005/03/09 18:22:19 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -321,8 +321,9 @@
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 @@
&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 = (