File:  [LON-CAPA] / doc / loncapafiles / mimetex_version_check.piml
Revision 1.1: download - view: text, annotated - select for diffs
Thu Dec 18 22:30:24 2008 UTC (15 years, 4 months ago) by raeburn
Branches: MAIN
CVS tags: HEAD
- If mimetex.cgi version has changed, remove gif files generated by previous version from mimetexcache directory.

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

<!-- $Id: mimetex_version_check.piml,v 1.1 2008/12/18 22:30:24 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>
<files>
<file>
<target dist="default">/</target>
<perlscript mode="fg">
    my $currversionfile = '/home/httpd/lonTabs/mimetex-version';
    my $newversionfile = '../cgi/mimeTeX/VERSION';
    my $fh;
    if (-e $newversionfile) {
        if (open($fh, "&lt;$newversionfile")) {
            my $newversion = &lt;$fh&gt;;
            close($fh);
            chomp($newversion);
            if ($newversion=~ /^\d+\.\d+$/) { 
                if (-e $currversionfile) {
                    if (open($fh, "&lt;$currversionfile")) {
                        my $currversion = &lt;$fh&gt;;
                        close($fh);
                        chomp($version);
                        if ($currversion=~ /^\d+\.\d+$/) {
                            if ($currversion ne $newversion) {
                                unlink('/home/httpd/cgi/mimetexcache/*.gif');
                                print "All .gif files cached by previous mimeTeX version have been removed from the mimetexcache directory\n";
                                if (open($fh, "&gt;$currversionfile")) {
                                    print $fh "$newversion";
                                    close($fh);
                                    print "mimetex-version file in /home/httpd/lonTabs set to version: $newversion.\n";
                                }
                            }
                        }
                    }
                } else {
                    unlink('/home/httpd/cgi/mimetexcache/*.gif');
                    print "All .gif files cached by previous mimeTeX version have been removed from the mimetexcache directory\n";
                    if (open($fh, "&gt;$currversionfile")) {
                        print $fh "$newversion";
                        close($fh);
                        print "mimetex-version file in /home/httpd/lonTabs set to version: $newversion.\n";`
                    }
                }
            }
        }
    }
</perlscript>
</file>
</files>
</piml>

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