[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonrep.pm

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 29 Jan 2007 22:07:15 -0000


albertel		Mon Jan 29 17:07:15 2007 EDT

  Modified files:              
    /loncom/lonnet/perl	lonrep.pm 
  Log:
  - only update the finfo if the file exists
  
  
Index: loncom/lonnet/perl/lonrep.pm
diff -u loncom/lonnet/perl/lonrep.pm:1.11 loncom/lonnet/perl/lonrep.pm:1.12
--- loncom/lonnet/perl/lonrep.pm:1.11	Mon Aug 21 11:21:31 2006
+++ loncom/lonnet/perl/lonrep.pm	Mon Jan 29 17:07:12 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Replication Manager
 #
-# $Id: lonrep.pm,v 1.11 2006/08/21 15:21:31 albertel Exp $
+# $Id: lonrep.pm,v 1.12 2007/01/29 22:07:12 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -37,7 +37,8 @@
 sub update_filename {
     my ($r,$filename) = @_;
     my $oldfile = $r->filename($filename);
-    if ($ENV{'MOD_PERL_API_VERSION'} == 2) {
+    if ($ENV{'MOD_PERL_API_VERSION'} == 2
+	&& -e $filename) {
 	require APR::Finfo;
 	require APR::Const;
 	$r->finfo(APR::Finfo::stat($filename, 
@@ -56,16 +57,16 @@
       if ($filename=~/\/$/) { return OK; }
       if (-e "$filename.in.transfer") {
 	sleep 10;
-	&update_filename($r,$filename);
-        if (-e $r->finfo) {
-	   return OK;
+        if (-e $filename) {
+	    &update_filename($r,$filename);
+	    return OK;
         } else {
-	   $r->log_reason("Waiting for file transfer timed out",$filename);
-	   return HTTP_SERVICE_UNAVAILABLE;
+	    $r->log_reason("Waiting for file transfer timed out",$filename);
+	    return HTTP_SERVICE_UNAVAILABLE;
         }
       } else {
           my $response=Apache::lonnet::repcopy($filename);
-          if ($response eq 'ok') {
+          if ($response eq 'ok' && -e $filename) {
 	      $r->path_info('');
 	      &update_filename($r,$filename);
               return OK;