Skip to content

Commit

Permalink
Merge branch 'MDL-77592-400' of https://github.com/golenkovm/moodle i…
Browse files Browse the repository at this point in the history
…nto MOODLE_400_STABLE
  • Loading branch information
andrewnicols committed May 10, 2023
2 parents bdd4333 + 427dff5 commit 7371e35
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 29 deletions.
29 changes: 2 additions & 27 deletions filter/tex/latex.php
Expand Up @@ -16,11 +16,8 @@ class latex {
* 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();
}

/**
Expand Down Expand Up @@ -160,26 +157,4 @@ function render( $formula, $filename, $fontsize=12, $density=240, $background=''

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;
}

}



2 changes: 0 additions & 2 deletions filter/tex/pix.php
Expand Up @@ -50,8 +50,6 @@
$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;
Expand Down

0 comments on commit 7371e35

Please sign in to comment.