File:  [LON-CAPA] / doc / loncapafiles / removenolongerused.piml
Revision 1.17: download - view: text, annotated - select for diffs
Mon Jul 8 23:27:32 2024 UTC (4 months, 3 weeks ago) by raeburn
Branches: MAIN
CVS tags: version_2_12_X, HEAD
- Add $Id so version information will be included, and license boilerplate.

<!DOCTYPE piml PUBLIC "-//TUX/DTD piml 1.0 Final//EN"
        "http://lpml.sourceforge.net/DTD/piml.dtd">
<!-- removenolongerused.piml -->

<!-- $Id: removenolongerused.piml,v 1.17 2024/07/08 23:27:32 raeburn Exp $ -->

<!--

This file is part of the LearningOnline Network with CAPA (LON-CAPA).

LON-CAPA is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

LON-CAPA is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with LON-CAPA; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

/home/httpd/html/adm/gpl.txt

http://www.lon-capa.org/

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

use File::Path();

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);

my %paths = (
              'londaemons' =&gt; '/home/httpd/perl',
              'apache'     =&gt; '/home/httpd/lib/perl/Apache',
              'londocroot' =&gt; '/home/httpd/html',
              'rcgifs'     =&gt; '/home/httpd/html/res/adm/pages',
              'debug'      =&gt; '/home/httpd/perl/debug',
            );
 
my %files = (
              'londaemons' =&gt; ['lonManage','lchtmldir','lonhttpd','lcuseradd','lonc'],
              'apache'     =&gt; ['londropadd.pm','lonconstruct.pm',
                               'lonremote.pm','admbookmarks.pm','lonassignments.pm'],
              'londocroot' =&gt; ['adm/rat/extpickcode.html',
                               'adm/rat/extpickframe.html',
                               'res/adm/pages/imgmaps.html',
                               'res/adm/pages/menu.html',
                               'res/adm/pages/homeworkmenu.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-3.2.1.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/js/jquery-ui-1.12.1.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/jQuery/js/css/smoothness/jquery-ui-1.12.1.custom.min.css',
                               'adm/reactionresponse/reaction_frame.html',
                               'adm/reactionresponse/reaction_window.html'],
              'debug'      =&gt; ['archive_coursedata_tables.pl'],
            );

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

my %multis = (
                'rcgifs'     =&gt; \@rcgifs,
             ); 
my @filestodelete = ();
my @dirstodelete = ();
my @multistodelete = ();
my @gifstodelete = ();
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);
                }
            }
        }
    }
}

foreach my $key (sort(keys(%multis))) {
    if ($paths{$key} ne '') {
        if (ref($multis{$key}) eq 'ARRAY') {
            foreach my $file (@{$dirs{$key}}) {
                if (-f $paths{$key}.'/'.$file) {
                    push(@multistodelete,$paths{$key}.'/'.$file);
                    push(@gifstodelete,$file);
                }
            }
        }
    }
}

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);
        }
    }
}

if (@multistodelete > 0) {
    my $num = scalar(@multistodelete);
    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".
          "Enter Y if you would all $num files to be deleted.\n\n".
          "Remove? Y or N:\n";
    my $choice=&lt;&gt;;
    chomp($choice);
    $choice =~ s/\s+//g;
    if ($choice eq 'Y') {
        foreach my $item (@multistodelete) {
            next if (($item =~/\*/) || ($item eq '') || ($item eq '/'));
            unlink($item);
        }
    }
}

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

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