mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 04:52:36 +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
@ -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…
x
Reference in New Issue
Block a user