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

www lon-capa-cvs@mail.lon-capa.org
Wed, 09 Nov 2005 09:07:00 -0000


www		Wed Nov  9 04:07:00 2005 EDT

  Modified files:              
    /loncom/publisher	loncfile.pm 
  Log:
  .bak files also need ignoring when deleting empty directories.
  
  
Index: loncom/publisher/loncfile.pm
diff -u loncom/publisher/loncfile.pm:1.73 loncom/publisher/loncfile.pm:1.74
--- loncom/publisher/loncfile.pm:1.73	Tue Nov  8 12:58:35 2005
+++ loncom/publisher/loncfile.pm	Wed Nov  9 04:06:59 2005
@@ -9,7 +9,7 @@
 #  and displays a page showing the results of the action.
 #
 #
-# $Id: loncfile.pm,v 1.73 2005/11/08 17:58:35 albertel Exp $
+# $Id: loncfile.pm,v 1.74 2005/11/09 09:06:59 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -187,20 +187,20 @@
 }
 
 # see if directory is empty
-# ignores any .meta, .save and .log files created for a previously
+# ignores any .meta, .save, .bak, and .log files created for a previously
 # published file, which has since been marked obsolete and deleted.
 sub empty_directory {
     my ($dirname,$phase) = @_;
     if (opendir DIR, $dirname) {
         my @files = grep(!/^\.\.?$/, readdir(DIR)); # ignore . and ..
         if (@files) { 
-            my @orphans = grep(/\.(meta|save|log)$/,@files);
+            my @orphans = grep(/\.(meta|save|log|bak)$/,@files);
             if (scalar(@files) - scalar(@orphans) > 0) { 
                 return 0;
             } else {
                 if (($phase eq 'Delete2') && (@orphans > 0)) {
                     foreach my $file (@orphans) {
-                        if ($file =~ /\.(meta|save|log)$/) {
+                        if ($file =~ /\.(meta|save|log|bak)$/) {
                             unlink($dirname.$file);
                         }
                     }