From 8c3c537bacf7bc8e3ef028dc075d60dcb7847d8d Mon Sep 17 00:00:00 2001 From: Mikhail Golenkov Date: Fri, 31 Mar 2023 11:17:01 +1100 Subject: [PATCH] MDL-77592 filter_tex: Use request dir instead of temp shared storage --- filter/tex/latex.php | 29 ++--------------------------- filter/tex/pix.php | 2 -- 2 files changed, 2 insertions(+), 29 deletions(-) diff --git a/filter/tex/latex.php b/filter/tex/latex.php index c23170a8785..825a63072b0 100644 --- a/filter/tex/latex.php +++ b/filter/tex/latex.php @@ -16,11 +16,8 @@ * Other platforms could/should be added */ public function __construct() { - global $CFG; - - // construct directory structure - $this->temp_dir = $CFG->tempdir . "/latex"; - make_temp_directory('latex'); + // Construct directory structure. + $this->temp_dir = make_request_directory(); } /** @@ -160,26 +157,4 @@ 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; - } - } - - - diff --git a/filter/tex/pix.php b/filter/tex/pix.php index 570e47330fa..679d436bd39 100644 --- a/filter/tex/pix.php +++ b/filter/tex/pix.php @@ -50,8 +50,6 @@ define('NO_MOODLE_COOKIES', true); // Because it interferes with caching $lateximage = $latex->render($texexp, $image, 12, $density, $background); if ($lateximage) { copy($lateximage, $pathname); - $latex->clean_up($md5); - } else { // failing that, use mimetex $texexp = $texcache->rawtext;