Annotation of doc/loncapafiles/removenolongerused.piml, revision 1.6

1.1       raeburn     1: <piml>
                      2: <targetroot>/</targetroot>
                      3: <files>
                      4: <file>
                      5: <target dist="default"></target>
                      6: <perlscript mode="fg">
                      7: 
1.2       raeburn     8: use File::Path();
1.1       raeburn     9: 
                     10: my @rcgifs = qw(anno.gif anot.gif anot2.gif back.gif bchat.gif bkm.gif blog.gif brws.gif catalog.gif ccat.gif ccrs.gif chrt.gif clst.gif com.gif conf.gif courses.gif cprv.gif cstr.gif del.gif docs.gif egrd.gif enrl.gif eval.gif fdbk.gif forw.gif grds.gif grps.gif keys.gif ledsend.gif list.gif logout.gif mail.gif mcrs.gif mrk.gif nav.gif new.gif parm.gif pcsrt.gif pcstr.gif pdfupload.gif pgrd.gif port.gif pparm.gif pref.gif prt.gif pub.gif rcrs.gif reload.gif remotebg.gif res.gif roles.gif rsrv.gif rtrv.gif sbkm.gif sctr.gif spacer.gif sprs.gif src.gif srvr.gif stat.gif subm.gif title.gif vbkm.gif);
                     11: 
                     12: my %paths = (
                     13:               'londaemons' =&gt; '/home/httpd/perl',
                     14:               'apache'     =&gt; '/home/httpd/lib/perl/Apache',
                     15:               'londocroot' =&gt; '/home/httpd/html',
                     16:               'rcgifs'     =&gt; '/home/httpd/html/res/adm/pages',
                     17:             );
                     18:  
                     19: my %files = (
1.5       raeburn    20:               'londaemons' =&gt; ['lonManage','lchtmldir','lonhttpd','lcuseradd','lonc'],
1.1       raeburn    21:               'apache'     =&gt; ['londropadd.pm','lonconstruct.pm',
1.6     ! raeburn    22:                                'lonremote.pm','admbookmarks.pm','lonassignments.pm'],
1.1       raeburn    23:               'londocroot' =&gt; ['adm/rat/extpickcode.html',
                     24:                                'adm/rat/extpickframe.html',
                     25:                                'res/adm/pages/imgmaps.html',
                     26:                                'res/adm/pages/menu.html',
                     27:                                'res/adm/pages/homeworkmenu.html'],
                     28:             );
                     29: 
                     30: my %dirs = (
                     31:               'londocroot' =&gt; 'adm/lonLCDfont',
                     32:                               'htmlarea',
                     33:                               'res/adm/pages/bookmarkmenu',
                     34:            );
                     35: 
                     36: my %multis = (
                     37:                  rcgifs'     =&gt; \@rcgifs,
                     38:              ); 
                     39: my @filestodelete = ();
                     40: my @dirstodelete = ();
                     41: my @multistodelete = ();
                     42: my @gifstodelete = ();
                     43: foreach my $key (sort(keys(%files))) {
                     44:     if ($paths{$key} ne '') {
                     45:         if (ref($files{$key}) eq 'ARRAY') {
                     46:             foreach my $file (@{$files{$key}}) {
                     47:                 if (-f $paths{$key}.'/'.$file) {
                     48:                     push(@filestodelete,$paths{$key}.'/'.$file);
                     49:                 }
                     50:             }
                     51:         }
                     52:     }
                     53: }
                     54: 
                     55: foreach my $key (sort(keys(%dirs))) {
                     56:     if ($paths{$key} ne '') {
                     57:         if (ref($dirs{$key}) eq 'ARRAY') {
                     58:             foreach my $dir (@{$dirs{$key}}) {
                     59:                 if (-d $paths{$key}.'/'.$dir) {
                     60:                     push(@dirstodelete,$paths{$key}.'/'.$dir);
                     61:                 }
                     62:             }
                     63:         }
                     64:     }
                     65: }
                     66: 
                     67: foreach my $key (sort(keys(%multis))) {
                     68:     if ($paths{$key} ne '') {
                     69:         if (ref($multis{$key}) eq 'ARRAY') {
                     70:             foreach my $file (@{$dirs{$key}}) {
                     71:                 if (-f $paths{$key}.'/'.$file) {
                     72:                     push(@multistodelete,$paths{$key}.'/'.$file);
                     73:                     push(@gifstodelete,$file);
                     74:                 }
                     75:             }
                     76:         }
                     77:     }
                     78: }
                     79: 
                     80: if (@dirstodelete > 0) {
                     81:     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";
                     82:     foreach my $dir (@dirstodelete) {
1.2       raeburn    83:         next if (($dir =~/\*/) || ($dir eq '') || ($dir eq '/'));  
1.1       raeburn    84:         print "$dir  -- delete? Enter: Y or N:\n";
                     85:         my $choice=&lt;&gt;;
                     86:         chomp($choice);
1.3       raeburn    87:         $choice =~ s/\s+//g;
1.2       raeburn    88:         if ($choice eq 'Y') {
                     89:             File::Path::remove_tree($dir);
1.1       raeburn    90:         }
                     91:     }
                     92: }
                     93: 
                     94: if (@filestodelete > 0) {
                     95:    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";
                     96:     foreach my $file (@filestodelete) {
1.2       raeburn    97:         next if (($file =~/\*/) || ($file eq '') || ($file eq '/'));
1.1       raeburn    98:         print "$file -- remove? Enter? Y or N:\n";
                     99:         my $choice=&lt;&gt;;
                    100:         chomp($choice);
1.2       raeburn   101:         $choice =~ s/\s+//g;
                    102:         if ($choice eq 'Y') {
1.1       raeburn   103:             unlink($file);
                    104:         }
                    105:     }
                    106: }
                    107: 
                    108: if (@multistodelete > 0) {
                    109:     my $num = scalar(@multistodelete);
                    110:     print "\nThe following $num gif image files were installed in $paths{rcgifs}/ for use with the LON-CAPA Remote Control (available in an earlier version of LON-CAPA), and now no longer used:\n".join(' ',@gifstodelete)."\n".
                    111:           "Enter Y if you would all $num files to be deleted.\n\n".
                    112:           "Remove? Y or N:\n";
                    113:     my $choice=&lt;&gt;;
                    114:     chomp($choice);
1.2       raeburn   115:     $choice =~ s/\s+//g;
                    116:     if ($choice eq 'Y') {
1.1       raeburn   117:         foreach my $item (@multistodelete) {
1.2       raeburn   118:             next if ((($item =~/\*/) || ($item eq '') || ($item eq '/'));
1.1       raeburn   119:             unlink($item);
                    120:         }
                    121:     }
                    122: }
                    123: 
                    124: </perlscript>
                    125: </file>
                    126: </files>
                    127: </piml>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>