File:  [LON-CAPA] / doc / loncapafiles / removenolongerused.piml
Revision 1.1.2.12: download - view: text, annotated - select for diffs
Fri Dec 24 16:09:09 2021 UTC (11 months, 1 week ago) by raeburn
Branches: version_2_11_X
CVS tags: version_2_11_4_uiuc, version_2_11_4_msu, version_2_11_4
- For 2.11
  Backport 1.15

<piml>
<targetroot>/</targetroot>
<files>
<file>
<target dist="default"></target>
<perlscript mode="fg">

use File::Path();

my %paths = (
              'londaemons' =&gt; '/home/httpd/perl',
              'apache'     =&gt; '/home/httpd/lib/perl/Apache',
              'londocroot' =&gt; '/home/httpd/html',
              'debug'      =&gt; '/home/httpd/perl/debug',
            );
 
my %files = (
              'londaemons' =&gt; ['lonManage','lchtmldir','lonhttpd','lcuseradd','lonc'],
              'apache'     =&gt; ['londropadd.pm','lonconstruct.pm',
                               'admbookmarks.pm','lonassignments.pm'],
              'londocroot' =&gt; ['adm/rat/extpickcode.html',
                               'adm/rat/extpickframe.html',
                               'adm/help/gif/vbkm.gif',
                               'adm/help/eps/vbkm.eps',
                               'adm/jQuery/js/jquery-1.3.2.min.js',
                               'adm/jQuery/js/jquery-1.6.2.min.js',
                               'adm/jQuery/js/jquery-1.11.3.min.js',
                               'adm/jQuery/js/jquery-ui-1.7.2.custom.min.js',
                               'adm/jQuery/js/jquery-ui-1.8.16.custom.min.js',
                               'adm/jQuery/js/jquery-ui-1.11.4.custom.min.js',
                               'adm/jQuery/css/smoothness/jquery-ui-1.7.2.custom.css',
                               'adm/jQuery/css/smoothness/jquery-ui-1.8.16.custom.css',
                               'adm/jQuery/js/css/smoothness/jquery-ui-1.11.4.custom.css',
                               'adm/reactionresponse/reaction_frame.html',
                               'adm/reactionresponse/reaction_window.html'],
              'debug'      =&gt; ['archive_coursedata_tables.pl'],
            );

my %dirs = (
              'londocroot' =&gt; ['htmlarea',
                                  'res/adm/pages/bookmarkmenu',
                                  'res/adm/pages/reactionresponse',
                                  'adm/jsMath',
                                  'adm/jQuery/css/ui-lightness'],
           );

my @filestodelete = ();
my @dirstodelete = ();
foreach my $key (sort(keys(%files))) {
    if ($paths{$key} ne '') {
        if (ref($files{$key}) eq 'ARRAY') {
            foreach my $file (@{$files{$key}}) {
                if (($file ne '') && (-f $paths{$key}.'/'.$file)) {
                    push(@filestodelete,$paths{$key}.'/'.$file);
                }
            }
        }
    }
}

foreach my $key (sort(keys(%dirs))) {
    if ($paths{$key} ne '') {
        if (ref($dirs{$key}) eq 'ARRAY') {
            foreach my $dir (@{$dirs{$key}}) {
                if (($dir ne '') && (-d $paths{$key}.'/'.$dir)) {
                    push(@dirstodelete,$paths{$key}.'/'.$dir);
                }
            }
        }
    }
}

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 '/'));  
        print "$dir  -- delete? Enter: Y or N:\n";
        my $choice=&lt;&gt;;
        chomp($choice);
        $choice =~ s/\s+//g;
        if ($choice eq 'Y') {
            File::Path::rmtree($dir);
        }
    }
}

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 '/'));
        print "$file -- remove? Enter? Y or N:\n";
        my $choice=&lt;&gt;;
        chomp($choice);
        $choice =~ s/\s+//g;
        if ($choice eq 'Y') {
            unlink($file);
        }
    }
}

</perlscript>
</file>
</files>
</piml>

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