Annotation of doc/loncapafiles/removenolongerused.piml, revision 1.1.2.7
1.1 raeburn 1: <piml>
2: <targetroot>/</targetroot>
3: <files>
4: <file>
5: <target dist="default"></target>
6: <perlscript mode="fg">
7:
1.1.2.2 raeburn 8: use File::Path();
1.1 raeburn 9:
10: my %paths = (
11: 'londaemons' => '/home/httpd/perl',
12: 'apache' => '/home/httpd/lib/perl/Apache',
13: 'londocroot' => '/home/httpd/html',
1.1.2.7 ! raeburn 14: 'debug' => '/home/httpd/perl/debug',
1.1 raeburn 15: );
16:
17: my %files = (
1.1.2.4 raeburn 18: 'londaemons' => ['lonManage','lchtmldir','lonhttpd','lcuseradd','lonc'],
1.1 raeburn 19: 'apache' => ['londropadd.pm','lonconstruct.pm',
1.1.2.5 raeburn 20: 'admbookmarks.pm','lonassignments.pm'],
1.1 raeburn 21: 'londocroot' => ['adm/rat/extpickcode.html',
1.1.2.6 raeburn 22: 'adm/rat/extpickframe.html',
23: 'adm/help/gif/vbkm.gif',
24: 'adm/help/eps/vbkm.eps'],
1.1.2.7 ! raeburn 25: 'debug' => ['archive_coursedata_tables.pl'],
1.1 raeburn 26: );
27:
28: my %dirs = (
1.1.2.7 ! raeburn 29: 'londocroot' => ['htmlarea',
! 30: 'res/adm/pages/bookmarkmenu'],
1.1 raeburn 31: );
32:
33: my @filestodelete = ();
34: my @dirstodelete = ();
35: foreach my $key (sort(keys(%files))) {
36: if ($paths{$key} ne '') {
37: if (ref($files{$key}) eq 'ARRAY') {
38: foreach my $file (@{$files{$key}}) {
1.1.2.7 ! raeburn 39: if (($file ne '') && (-f $paths{$key}.'/'.$file)) {
1.1 raeburn 40: push(@filestodelete,$paths{$key}.'/'.$file);
41: }
42: }
43: }
44: }
45: }
46:
47: foreach my $key (sort(keys(%dirs))) {
48: if ($paths{$key} ne '') {
49: if (ref($dirs{$key}) eq 'ARRAY') {
50: foreach my $dir (@{$dirs{$key}}) {
1.1.2.7 ! raeburn 51: if (($dir ne '') && (-d $paths{$key}.'/'.$dir)) {
1.1 raeburn 52: push(@dirstodelete,$paths{$key}.'/'.$dir);
53: }
54: }
55: }
56: }
57: }
58:
59: if (@dirstodelete > 0) {
60: 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";
61: foreach my $dir (@dirstodelete) {
1.1.2.2 raeburn 62: next if (($dir =~/\*/) || ($dir eq '') || ($dir eq '/'));
1.1 raeburn 63: print "$dir -- delete? Enter: Y or N:\n";
64: my $choice=<>;
65: chomp($choice);
1.1.2.2 raeburn 66: $choice =~ s/\s+//g;
67: if ($choice eq 'Y') {
68: File::Path::remove_tree($dir);
1.1 raeburn 69: }
70: }
71: }
72:
73: if (@filestodelete > 0) {
74: 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";
75: foreach my $file (@filestodelete) {
1.1.2.2 raeburn 76: next if (($file =~/\*/) || ($file eq '') || ($file eq '/'));
1.1 raeburn 77: print "$file -- remove? Enter? Y or N:\n";
78: my $choice=<>;
79: chomp($choice);
1.1.2.2 raeburn 80: $choice =~ s/\s+//g;
81: if ($choice eq 'Y') {
1.1 raeburn 82: unlink($file);
83: }
84: }
85: }
86:
87: </perlscript>
88: </file>
89: </files>
90: </piml>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>