| … | |
… | |
| 13 | use WeBWorK::PG::Translator; |
13 | use WeBWorK::PG::Translator; |
| 14 | use WeBWorK::PG::IO; |
14 | use WeBWorK::PG::IO; |
| 15 | use Benchmark; |
15 | use Benchmark; |
| 16 | use MIME::Base64 qw( encode_base64 decode_base64); |
16 | use MIME::Base64 qw( encode_base64 decode_base64); |
| 17 | |
17 | |
| 18 | my $debugOn =0; |
18 | my $debugOn =1; |
| 19 | my $PASSWORD = 'geometry'; |
19 | my $PASSWORD = $Global::PASSWORD; |
| 20 | |
20 | |
| 21 | |
21 | |
| 22 | my $TEMPDIRECTORY = '/ww/htdocs/tmp/daemon/'; |
22 | my $TEMPDIRECTORY = $Global::TEMPDIRECTORY; |
| 23 | my $TEMP_BASE_URL = 'http://webwork-db.math.rochester.edu/tmp/daemon/'; |
23 | my $TEMP_BASE_URL = $Global::TEMP_BASE_URL; |
| 24 | my $externalLatexPath = "/usr/local/bin/latex"; |
24 | my $externalLatexPath = $Global::externalLatexPath; |
| 25 | my $externalDvipsPath = "/usr/local/bin/dvips"; |
25 | my $externalDvipsPath = $Global::externalDvipsPath; |
| 26 | my $externalpdflatexPath = "/usr/local/bin/pdflatex"; |
26 | my $externalpdflatexPath = $Global::externalpdflatexPath; |
| 27 | my $externalGsPath = "/usr/local/bin/gs"; |
27 | my $externalGsPath = $Global::externalGsPath; |
| 28 | |
28 | |
| 29 | |
29 | |
| 30 | # variables formerly set in Global |
30 | # variables formerly set in Global |
| 31 | my $tmp_directory_permission = 0775; |
31 | my $tmp_directory_permission = $Global::tmp_directory_permission; |
| 32 | my $numericalGroupID='1005'; # group ID for webadmin |
32 | my $numericalGroupID = $Global::numericalGroupID; # group ID for webadmin |
| 33 | |
33 | |
| 34 | sub tex2pdf { |
34 | sub tex2pdf { |
| 35 | |
35 | |
| 36 | my $rh = shift; |
36 | my $rh = shift; |
| 37 | local($|)=1; |
37 | local($|)=1; |
| … | |
… | |
| 87 | # print "psCommandLine: $psCommandLine\n"; |
87 | # print "psCommandLine: $psCommandLine\n"; |
| 88 | # print "pdfCommandLine: $pdfCommandLine\n"; |
88 | # print "pdfCommandLine: $pdfCommandLine\n"; |
| 89 | #print "execute pdflatex", `$externalpdflatexPath $texFileBasePath.tex`, "\n"; |
89 | #print "execute pdflatex", `$externalpdflatexPath $texFileBasePath.tex`, "\n"; |
| 90 | #print "done $externalpdflatexPath $texFileBasePath.tex\n"; |
90 | #print "done $externalpdflatexPath $texFileBasePath.tex\n"; |
| 91 | # Change to the working directory and create the pdf files. |
91 | # Change to the working directory and create the pdf files. |
| 92 | my $wd = $TEMPDIRECTORY.join("/",@pathElements); |
92 | my $wd = $TEMPDIRECTORY.join("/",@pathElements); # working directory |
| 93 | #print "---cd $wd && $externalpdflatexPath $fileName.tex\n"; |
93 | # print "---cd $wd && $externalpdflatexPath $fileName.tex\n"; |
| 94 | |
94 | |
| 95 | system "cd $wd && $externalpdflatexPath $fileName.tex"; |
95 | system "cd $wd && $externalpdflatexPath $fileName.tex"; |
| 96 | chmod 0777, "$texFileBasePath.pdf"; |
96 | chmod 0777, "$texFileBasePath.pdf"; |
| 97 | unless ($debugOn) { |
97 | unless ($debugOn) { |
| 98 | unlink("$texFileBasePath.tex","$texFileBasePath.log","$texFileBasePath.aux", |
98 | unlink("$texFileBasePath.tex","$texFileBasePath.log","$texFileBasePath.aux", |