mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
MDL-77592 filter_tex: Use request dir instead of temp shared storage
This commit is contained in:
parent
b2cca9ef62
commit
5303c032bb
2 changed files with 2 additions and 29 deletions
|
@ -16,11 +16,8 @@
|
||||||
* Other platforms could/should be added
|
* Other platforms could/should be added
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
global $CFG;
|
// Construct directory structure.
|
||||||
|
$this->temp_dir = make_request_directory();
|
||||||
// construct directory structure
|
|
||||||
$this->temp_dir = $CFG->tempdir . "/latex";
|
|
||||||
make_temp_directory('latex');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -160,26 +157,4 @@
|
||||||
|
|
||||||
return $img;
|
return $img;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Delete files created in temporary area
|
|
||||||
* Don't forget to copy the final gif/png before calling this
|
|
||||||
* @param string $filename file base (no extension)
|
|
||||||
*/
|
|
||||||
function clean_up( $filename ) {
|
|
||||||
global $CFG;
|
|
||||||
|
|
||||||
unlink( "{$this->temp_dir}/$filename.tex" );
|
|
||||||
unlink( "{$this->temp_dir}/$filename.dvi" );
|
|
||||||
unlink( "{$this->temp_dir}/$filename.ps" );
|
|
||||||
$convertformat = get_config('filter_tex', 'convertformat');
|
|
||||||
unlink( "{$this->temp_dir}/$filename.{$convertformat}" );
|
|
||||||
unlink( "{$this->temp_dir}/$filename.aux" );
|
|
||||||
unlink( "{$this->temp_dir}/$filename.log" );
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -50,8 +50,6 @@ define('NO_MOODLE_COOKIES', true); // Because it interferes with caching
|
||||||
$lateximage = $latex->render($texexp, $image, 12, $density, $background);
|
$lateximage = $latex->render($texexp, $image, 12, $density, $background);
|
||||||
if ($lateximage) {
|
if ($lateximage) {
|
||||||
copy($lateximage, $pathname);
|
copy($lateximage, $pathname);
|
||||||
$latex->clean_up($md5);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// failing that, use mimetex
|
// failing that, use mimetex
|
||||||
$texexp = $texcache->rawtext;
|
$texexp = $texcache->rawtext;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue