--- doc/loncapafiles/removenolongerused.piml 2013/08/07 18:30:49 1.1.2.1
+++ doc/loncapafiles/removenolongerused.piml 2014/06/20 19:25:41 1.1.2.7
@@ -5,25 +5,29 @@
-use File::Path qw(remove_tree);
+use File::Path();
my %paths = (
'londaemons' => '/home/httpd/perl',
'apache' => '/home/httpd/lib/perl/Apache',
'londocroot' => '/home/httpd/html',
+ 'debug' => '/home/httpd/perl/debug',
);
my %files = (
- 'londaemons' => ['lonManage','lchtmldir','lonhttpd'],
+ 'londaemons' => ['lonManage','lchtmldir','lonhttpd','lcuseradd','lonc'],
'apache' => ['londropadd.pm','lonconstruct.pm',
- 'admbookmarks.pm'],
+ 'admbookmarks.pm','lonassignments.pm'],
'londocroot' => ['adm/rat/extpickcode.html',
- 'adm/rat/extpickframe.html'],
+ 'adm/rat/extpickframe.html',
+ 'adm/help/gif/vbkm.gif',
+ 'adm/help/eps/vbkm.eps'],
+ 'debug' => ['archive_coursedata_tables.pl'],
);
my %dirs = (
- 'londocroot' => 'htmlarea',
- 'res/adm/pages/bookmarkmenu',
+ 'londocroot' => ['htmlarea',
+ 'res/adm/pages/bookmarkmenu'],
);
my @filestodelete = ();
@@ -32,7 +36,7 @@ foreach my $key (sort(keys(%files))) {
if ($paths{$key} ne '') {
if (ref($files{$key}) eq 'ARRAY') {
foreach my $file (@{$files{$key}}) {
- if (-f $paths{$key}.'/'.$file) {
+ if (($file ne '') && (-f $paths{$key}.'/'.$file)) {
push(@filestodelete,$paths{$key}.'/'.$file);
}
}
@@ -44,7 +48,7 @@ foreach my $key (sort(keys(%dirs))) {
if ($paths{$key} ne '') {
if (ref($dirs{$key}) eq 'ARRAY') {
foreach my $dir (@{$dirs{$key}}) {
- if (-d $paths{$key}.'/'.$dir) {
+ if (($dir ne '') && (-d $paths{$key}.'/'.$dir)) {
push(@dirstodelete,$paths{$key}.'/'.$dir);
}
}
@@ -55,12 +59,13 @@ foreach my $key (sort(keys(%dirs))) {
if (@dirstodelete > 0) {
print "\nThe following directories were installed for an earlier version of LON-CAPA, and are no longer needed. It is recommended that you delete them. For each one, enter Y if you would the directory to be deleted.\n\n";
foreach my $dir (@dirstodelete) {
- next if (($dir =~/*/) || ($dir eq '') || ($dir eq '/'));
+ next if (($dir =~/\*/) || ($dir eq '') || ($dir eq '/'));
print "$dir -- delete? Enter: Y or N:\n";
my $choice=<>;
chomp($choice);
- if ($choice==Y) {
- remove_tree($dir);
+ $choice =~ s/\s+//g;
+ if ($choice eq 'Y') {
+ File::Path::remove_tree($dir);
}
}
}
@@ -68,11 +73,12 @@ if (@dirstodelete > 0) {
if (@filestodelete > 0) {
print "\nThe following files were installed for an earlier version of LON-CAPA, and are no longer needed. It is recommended that you delete them. For each one, enter Y if you would the file to be deleted.\n\n";
foreach my $file (@filestodelete) {
- next if (($file =~/*/) || ($file eq '') || ($file eq '/'));
+ next if (($file =~/\*/) || ($file eq '') || ($file eq '/'));
print "$file -- remove? Enter? Y or N:\n";
my $choice=<>;
chomp($choice);
- if ($choice==Y) {
+ $choice =~ s/\s+//g;
+ if ($choice eq 'Y') {
unlink($file);
}
}