File:
[LON-CAPA] /
doc /
loncapafiles /
mimetex_version_check.piml
Revision
1.2:
download - view:
text,
annotated -
select for diffs
Sat Dec 27 01:21:48 2008 UTC (15 years, 9 months ago) by
raeburn
Branches:
MAIN
CVS tags:
version_2_9_X,
version_2_9_99_0,
version_2_9_1,
version_2_9_0,
version_2_8_X,
version_2_8_99_1,
version_2_8_99_0,
version_2_8_2,
version_2_8_1,
version_2_8_0,
version_2_7_99_1,
version_2_7_99_0,
version_2_12_X,
version_2_11_X,
version_2_11_5_msu,
version_2_11_5,
version_2_11_4_uiuc,
version_2_11_4_msu,
version_2_11_4,
version_2_11_3_uiuc,
version_2_11_3_msu,
version_2_11_3,
version_2_11_2_uiuc,
version_2_11_2_msu,
version_2_11_2_educog,
version_2_11_2,
version_2_11_1,
version_2_11_0_RC3,
version_2_11_0_RC2,
version_2_11_0_RC1,
version_2_11_0,
version_2_10_X,
version_2_10_1,
version_2_10_0_RC2,
version_2_10_0_RC1,
version_2_10_0,
loncapaMITrelate_1,
language_hyphenation_merge,
language_hyphenation,
bz6209-base,
bz6209,
HEAD,
GCI_3,
GCI_2,
GCI_1,
BZ4492-merge,
BZ4492-feature_horizontal_radioresponse,
BZ4492-feature_Support_horizontal_radioresponse,
BZ4492-Support_horizontal_radioresponse
- Typo - unwanted `
- Code to remove gif files from mimetexcache moved to sub: &clear_mimetex_cache().
- print warning if VERSION file could not be found in cgi/mimeTeX.
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.2 2008/12/27 01:21:48 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, "<$newversionfile")) {
42: my $newversion = <$fh>;
43: close($fh);
44: chomp($newversion);
45: if ($newversion=~ /^\d+\.\d+$/) {
46: if (-e $currversionfile) {
47: if (open($fh, "<$currversionfile")) {
48: my $currversion = <$fh>;
49: close($fh);
50: chomp($version);
51: if ($currversion=~ /^\d+\.\d+$/) {
52: if ($currversion ne $newversion) {
53: &clear_mimetex_cache();
54: if (open($fh, ">$currversionfile")) {
55: print $fh "$newversion";
56: close($fh);
57: print "mimetex-version file in /home/httpd/lonTabs set to version: $newversion.\n";
58: }
59: }
60: }
61: }
62: } else {
63: &clear_mimetex_cache();
64: if (open($fh, ">$currversionfile")) {
65: print $fh "$newversion";
66: close($fh);
67: print "mimetex-version file in /home/httpd/lonTabs set to version: $newversion.\n";
68: }
69: }
70: }
71: }
72: } else {
73: print "Couldn't find the mimetex version file: $newversionfile\n";
74: }
75:
76: sub clear_mimetex_cache {
77: my $mimetexcache = '/home/httpd/cgi-bin/mimetexcache';
78: if (opendir(my $dir,$mimetexcache)) {
79: my @gifs = grep(/^[^\/]+\.gif$/,readdir($dir));
80: if (@gifs > 0) {
81: my $counter = 0;
82: foreach my $gif (@gifs) {
83: unlink("$mimetexcache/$gif");
84: $counter ++;
85: }
86: if ($counter) {
87: print "$counter .gif file(s) cached by previous mimeTeX version have been removed from the mimetexcache directory\n";
88: }
89: }
90: closedir($dir);
91: } else {
92: print "An error occurred opening the directory: $mimetexcache\n";
93: }
94: }
95: </perlscript>
96: </file>
97: </files>
98: </piml>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>