version 1.73, 2005/11/08 17:58:35
|
version 1.74, 2005/11/09 09:06:59
|
Line 187 sub obsolete_unpub {
|
Line 187 sub obsolete_unpub {
|
} |
} |
|
|
# see if directory is empty |
# 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. |
# published file, which has since been marked obsolete and deleted. |
sub empty_directory { |
sub empty_directory { |
my ($dirname,$phase) = @_; |
my ($dirname,$phase) = @_; |
if (opendir DIR, $dirname) { |
if (opendir DIR, $dirname) { |
my @files = grep(!/^\.\.?$/, readdir(DIR)); # ignore . and .. |
my @files = grep(!/^\.\.?$/, readdir(DIR)); # ignore . and .. |
if (@files) { |
if (@files) { |
my @orphans = grep(/\.(meta|save|log)$/,@files); |
my @orphans = grep(/\.(meta|save|log|bak)$/,@files); |
if (scalar(@files) - scalar(@orphans) > 0) { |
if (scalar(@files) - scalar(@orphans) > 0) { |
return 0; |
return 0; |
} else { |
} else { |
if (($phase eq 'Delete2') && (@orphans > 0)) { |
if (($phase eq 'Delete2') && (@orphans > 0)) { |
foreach my $file (@orphans) { |
foreach my $file (@orphans) { |
if ($file =~ /\.(meta|save|log)$/) { |
if ($file =~ /\.(meta|save|log|bak)$/) { |
unlink($dirname.$file); |
unlink($dirname.$file); |
} |
} |
} |
} |