MDL-44257 message: check if the attachment exists before remove it
Credit goes to Mark Nielsen, thanks.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user