[LON-CAPA-cvs] cvs: loncom(version_0_5_1) /lonnet/perl lonnet.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Tue, 03 Sep 2002 01:29:35 -0000
albertel Mon Sep 2 21:29:35 2002 EDT
Modified files: (Branch: version_0_5_1)
/loncom/lonnet/perl lonnet.pm
Log:
- backport of 1.275, CHRT fixes
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.267.4.4 loncom/lonnet/perl/lonnet.pm:1.267.4.5
--- loncom/lonnet/perl/lonnet.pm:1.267.4.4 Fri Aug 30 18:01:31 2002
+++ loncom/lonnet/perl/lonnet.pm Mon Sep 2 21:29:35 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.267.4.4 2002/08/30 22:01:31 albertel Exp $
+# $Id: lonnet.pm,v 1.267.4.5 2002/09/03 01:29:35 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2427,6 +2427,30 @@
my @emptyResults = ();
push(@emptyResults, 'missing domain');
return split(':',@emptyResults);
+ }
+}
+
+# --------------------------------------------- GetFileTimestamp
+# This function utilizes dirlist and returns the date stamp for
+# when it was last modified. It will also return an error of -1
+# if an error occurs
+
+sub GetFileTimestamp {
+ my ($studentDomain,$studentName,$filename,$root)=@_;
+ $studentDomain=~s/\W//g;
+ $studentName=~s/\W//g;
+ my $subdir=$studentName.'__';
+ $subdir =~ s/(.)(.)(.).*/$1\/$2\/$3/;
+ my $proname="$studentDomain/$subdir/$studentName";
+ $proname .= '/'.$filename;
+ my @dir = &Apache::lonnet::dirlist($proname, $studentDomain, $studentName,
+ $root);
+ my $fileStat = $dir[0];
+ my @stats = split('&', $fileStat);
+ if($stats[0] ne 'empty' && $stats[0] ne 'no_such_dir') {
+ return $stats[9];
+ } else {
+ return -1;
}
}