[LON-CAPA-cvs] cvs: loncom / lond
raeburn
raeburn at source.lon-capa.org
Sun May 8 15:05:10 EDT 2016
raeburn Sun May 8 19:05:10 2016 EDT
Modified files:
/loncom lond
Log:
- &remove_user_file_handler() should remove .bak file (if one exists)
when removing uploaded html file from a course.
Index: loncom/lond
diff -u loncom/lond:1.519 loncom/lond:1.520
--- loncom/lond:1.519 Sat Apr 2 04:30:29 2016
+++ loncom/lond Sun May 8 19:05:10 2016
@@ -2,7 +2,7 @@
# The LearningOnline Network
# lond "LON Daemon" Server (port "LOND" 5663)
#
-# $Id: lond,v 1.519 2016/04/02 04:30:29 raeburn Exp $
+# $Id: lond,v 1.520 2016/05/08 19:05:10 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -64,7 +64,7 @@
my $status='';
my $lastlog='';
-my $VERSION='$Revision: 1.519 $'; #' stupid emacs
+my $VERSION='$Revision: 1.520 $'; #' stupid emacs
my $remoteVERSION;
my $currenthostid="default";
my $currentdomainid;
@@ -2496,11 +2496,20 @@
if (-e $file) {
#
# If the file is a regular file unlink is fine...
- # However it's possible the client wants a dir.
- # removed, in which case rmdir is more approprate:
+ # However it's possible the client wants a dir
+ # removed, in which case rmdir is more appropriate.
+ # Note: rmdir will only remove an empty directory.
#
if (-f $file){
unlink($file);
+ # for html files remove the associated .bak file
+ # which may have been created by the editor.
+ if ($ufile =~ m{^((docs|supplemental)/(?:\d+|default)/\d+(?:|/.+)/)[^/]+\.x?html?$}i) {
+ my $path = $1;
+ if (-e $file.'.bak') {
+ unlink($file.'.bak');
+ }
+ }
} elsif(-d $file) {
rmdir($file);
}
More information about the LON-CAPA-cvs
mailing list