mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-44257 message: check if the attachment exists before remove it
Credit goes to Mark Nielsen, thanks.
This commit is contained in:
parent
482abd0f70
commit
68e50bc80b
1 changed files with 3 additions and 1 deletions
|
@ -88,7 +88,9 @@ class message_output_email extends message_output {
|
|||
$eventdata->fullmessagehtml, $attachment, $attachname);
|
||||
|
||||
// Remove an attachment file if any.
|
||||
@unlink($attachment);
|
||||
if (!empty($attachment) && file_exists($CFG->dataroot.'/'.$attachment)) {
|
||||
unlink($CFG->dataroot.'/'.$attachment);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue