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.

    1: <!DOCTYPE piml PUBLIC "-//TUX/DTD piml 1.0 Final//EN" 
    2: 	"http://lpml.sourceforge.net/DTD/piml.dtd">
    3: <!-- mimetex_version_check.piml -->
    4: <!-- Stuart Raeburn -->
    5: 
    6: <!-- $Id: mimetex_version_check.piml,v 1.1 2008/12/18 22:30:24 raeburn Exp $ -->
    7: 
    8: <!--
    9: 
   10: This file is part of the LearningOnline Network with CAPA (LON-CAPA).
   11: 
   12: LON-CAPA is free software; you can redistribute it and/or modify
   13: it under the terms of the GNU General Public License as published by
   14: the Free Software Foundation; either version 2 of the License, or
   15: (at your option) any later version.
   16: 
   17: LON-CAPA is distributed in the hope that it will be useful,
   18: but WITHOUT ANY WARRANTY; without even the implied warranty of
   19: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   20: GNU General Public License for more details.
   21: 
   22: You should have received a copy of the GNU General Public License
   23: along with LON-CAPA; if not, write to the Free Software
   24: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   25: 
   26: /home/httpd/html/adm/gpl.txt
   27: 
   28: http://www.lon-capa.org/
   29: 
   30: -->
   31: 
   32: <piml>
   33: <files>
   34: <file>
   35: <target dist="default">/</target>
   36: <perlscript mode="fg">
   37:     my $currversionfile = '/home/httpd/lonTabs/mimetex-version';
   38:     my $newversionfile = '../cgi/mimeTeX/VERSION';
   39:     my $fh;
   40:     if (-e $newversionfile) {
   41:         if (open($fh, "&lt;$newversionfile")) {
   42:             my $newversion = &lt;$fh&gt;;
   43:             close($fh);
   44:             chomp($newversion);
   45:             if ($newversion=~ /^\d+\.\d+$/) { 
   46:                 if (-e $currversionfile) {
   47:                     if (open($fh, "&lt;$currversionfile")) {
   48:                         my $currversion = &lt;$fh&gt;;
   49:                         close($fh);
   50:                         chomp($version);
   51:                         if ($currversion=~ /^\d+\.\d+$/) {
   52:                             if ($currversion ne $newversion) {
   53:                                 unlink('/home/httpd/cgi/mimetexcache/*.gif');
   54:                                 print "All .gif files cached by previous mimeTeX version have been removed from the mimetexcache directory\n";
   55:                                 if (open($fh, "&gt;$currversionfile")) {
   56:                                     print $fh "$newversion";
   57:                                     close($fh);
   58:                                     print "mimetex-version file in /home/httpd/lonTabs set to version: $newversion.\n";
   59:                                 }
   60:                             }
   61:                         }
   62:                     }
   63:                 } else {
   64:                     unlink('/home/httpd/cgi/mimetexcache/*.gif');
   65:                     print "All .gif files cached by previous mimeTeX version have been removed from the mimetexcache directory\n";
   66:                     if (open($fh, "&gt;$currversionfile")) {
   67:                         print $fh "$newversion";
   68:                         close($fh);
   69:                         print "mimetex-version file in /home/httpd/lonTabs set to version: $newversion.\n";`
   70:                     }
   71:                 }
   72:             }
   73:         }
   74:     }
   75: </perlscript>
   76: </file>
   77: </files>
   78: </piml>

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