MDL-61537 assignfeedback_editpdf: Check for existence of old test images

Since error suppression was removed with the call to unlink() to make
sure that there are no previous test image files before testing for the
gs path, make sure that it exists first before deleting to prevent it
from throwing any errors.
This commit is contained in:
Jun Pataleta 2019-03-21 22:38:05 +08:00
parent 00229165d4
commit f2ad613278

View File

@ -737,7 +737,11 @@ class pdf extends \FPDI {
}
$testimagefolder = \make_temp_directory('assignfeedback_editpdf_test');
unlink($testimagefolder . '/' . self::IMAGE_PAGE . '0.png'); // Delete any previous test images.
$filepath = $testimagefolder . '/' . self::IMAGE_PAGE . '0.png';
// Delete any previous test images, if they exist.
if (file_exists($filepath)) {
unlink($filepath);
}
$pdf = new pdf();
$pdf->set_pdf($testfile);