[LON-CAPA-cvs] cvs: loncom /publisher loncfile.pm

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 24 Aug 2004 15:53:21 -0000


albertel		Tue Aug 24 11:53:21 2004 EDT

  Modified files:              
    /loncom/publisher	loncfile.pm 
  Log:
  - bug#3375 copy metadata when copying a file
  
  
Index: loncom/publisher/loncfile.pm
diff -u loncom/publisher/loncfile.pm:1.60 loncom/publisher/loncfile.pm:1.61
--- loncom/publisher/loncfile.pm:1.60	Fri Aug 20 12:29:15 2004
+++ loncom/publisher/loncfile.pm	Tue Aug 24 11:53:21 2004
@@ -9,7 +9,7 @@
 #  and displays a page showing the results of the action.
 #
 #
-# $Id: loncfile.pm,v 1.60 2004/08/20 16:29:15 www Exp $
+# $Id: loncfile.pm,v 1.61 2004/08/24 15:53:21 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -988,11 +988,16 @@
 	unless (copy($oldfile, $newfile)) {
 	    $request->print('<font color="red"> '.&mt('copy Error').': '.$!.'</font>');
 	    return 0;
+	} elsif (!chmod(0660, $newfile)) {
+	    $request->print('<font color="red"> '.&mt('chmod error').': '.$!.'</font>');
+	    return 0;
+	} elsif (-e $oldfile.'.meta' && 
+		 !copy($oldfile.'.meta', $newfile.'.meta') &&
+		 !chmod(0660, $newfile.'.meta')) {
+	    $request->print('<font color="red"> '.&mt('copy metadata error').
+			    ': '.$!.'</font>');
+	    return 0;
 	} else {
-	    unless (chmod(0660, $newfile)) {
-		$request->print('<font color="red"> '.&mt('chmod error').': '.$!.'</font>');
-		return 0;
-	    }
 	    return 1;
 	}
     } else {