Diff for /doc/loncapafiles/removenolongerused.piml between versions 1.1.2.1 and 1.1.2.10

version 1.1.2.1, 2013/08/07 18:30:49 version 1.1.2.10, 2016/08/09 19:17:55
Line 5 Line 5
 <target dist="default"></target>  <target dist="default"></target>
 <perlscript mode="fg">  <perlscript mode="fg">
   
 use File::Path qw(remove_tree);  use File::Path();
   
 my %paths = (  my %paths = (
               'londaemons' =&gt; '/home/httpd/perl',                'londaemons' =&gt; '/home/httpd/perl',
               'apache'     =&gt; '/home/httpd/lib/perl/Apache',                'apache'     =&gt; '/home/httpd/lib/perl/Apache',
               'londocroot' =&gt; '/home/httpd/html',                'londocroot' =&gt; '/home/httpd/html',
                 'debug'      =&gt; '/home/httpd/perl/debug',
             );              );
     
 my %files = (  my %files = (
               'londaemons' =&gt; ['lonManage','lchtmldir','lonhttpd'],                'londaemons' =&gt; ['lonManage','lchtmldir','lonhttpd','lcuseradd','lonc'],
               'apache'     =&gt; ['londropadd.pm','lonconstruct.pm',                'apache'     =&gt; ['londropadd.pm','lonconstruct.pm',
                                'admbookmarks.pm'],                                 'admbookmarks.pm','lonassignments.pm'],
               'londocroot' =&gt; ['adm/rat/extpickcode.html',                'londocroot' =&gt; ['adm/rat/extpickcode.html',
                                'adm/rat/extpickframe.html'],                                 'adm/rat/extpickframe.html',
                                  'adm/help/gif/vbkm.gif',
                                  'adm/help/eps/vbkm.eps'],
                 'debug'      =&gt; ['archive_coursedata_tables.pl'],
             );              );
   
 my %dirs = (  my %dirs = (
               'londocroot' =&gt; 'htmlarea',                'londocroot' =&gt; ['htmlarea',
                               'res/adm/pages/bookmarkmenu',                                    'res/adm/pages/bookmarkmenu',
                                     'res/adm/pages/reactionresponse',
                                     'adm/jsMath'],
            );             );
   
 my @filestodelete = ();  my @filestodelete = ();
Line 32  foreach my $key (sort(keys(%files))) { Line 38  foreach my $key (sort(keys(%files))) {
     if ($paths{$key} ne '') {      if ($paths{$key} ne '') {
         if (ref($files{$key}) eq 'ARRAY') {          if (ref($files{$key}) eq 'ARRAY') {
             foreach my $file (@{$files{$key}}) {              foreach my $file (@{$files{$key}}) {
                 if (-f $paths{$key}.'/'.$file) {                  if (($file ne '') && (-f $paths{$key}.'/'.$file)) {
                     push(@filestodelete,$paths{$key}.'/'.$file);                      push(@filestodelete,$paths{$key}.'/'.$file);
                 }                  }
             }              }
Line 44  foreach my $key (sort(keys(%dirs))) { Line 50  foreach my $key (sort(keys(%dirs))) {
     if ($paths{$key} ne '') {      if ($paths{$key} ne '') {
         if (ref($dirs{$key}) eq 'ARRAY') {          if (ref($dirs{$key}) eq 'ARRAY') {
             foreach my $dir (@{$dirs{$key}}) {              foreach my $dir (@{$dirs{$key}}) {
                 if (-d $paths{$key}.'/'.$dir) {                  if (($dir ne '') && (-d $paths{$key}.'/'.$dir)) {
                     push(@dirstodelete,$paths{$key}.'/'.$dir);                      push(@dirstodelete,$paths{$key}.'/'.$dir);
                 }                  }
             }              }
Line 55  foreach my $key (sort(keys(%dirs))) { Line 61  foreach my $key (sort(keys(%dirs))) {
 if (@dirstodelete > 0) {  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";      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) {      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";          print "$dir  -- delete? Enter: Y or N:\n";
         my $choice=&lt;&gt;;          my $choice=&lt;&gt;;
         chomp($choice);          chomp($choice);
         if ($choice==Y) {          $choice =~ s/\s+//g;
             remove_tree($dir);          if ($choice eq 'Y') {
               File::Path::rmtree($dir);
         }          }
     }      }
 }  }
Line 68  if (@dirstodelete > 0) { Line 75  if (@dirstodelete > 0) {
 if (@filestodelete > 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";     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) {      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";          print "$file -- remove? Enter? Y or N:\n";
         my $choice=&lt;&gt;;          my $choice=&lt;&gt;;
         chomp($choice);          chomp($choice);
         if ($choice==Y) {          $choice =~ s/\s+//g;
           if ($choice eq 'Y') {
             unlink($file);              unlink($file);
         }          }
     }      }

Removed from v.1.1.2.1  
changed lines
  Added in v.1.1.2.10


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