1
0
Fork 0

Merge pull request #8196 from nupplaphil/bug/8000-phpmailer

Fix invalid "emailer_send_prepare" Hook
This commit is contained in:
Hypolite Petovan 2020-01-29 15:16:22 -05:00 committed by GitHub
commit f2547947c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 5 deletions

View file

@ -475,7 +475,7 @@ Eine komplette Liste aller Hook-Callbacks mit den zugehörigen Dateien (am 01-Ap
### src/Util/Emailer.php
Hook::callAll('emailer_send_prepare', $params);
Hook::callAll('emailer_send_prepare', $email);
Hook::callAll("emailer_send", $hookdata);
### src/Util/Map.php

View file

@ -132,4 +132,25 @@ class Email implements IEmail
return $newEmail;
}
/**
* Creates a new Email instance based on a given prototype
*
* @param static $prototype The base prototype
* @param array $data The delta-data (key must be an existing property)
*
* @return static The new email instance
*/
public static function createFromPrototype(Email $prototype, array $data = [])
{
$newMail = clone $prototype;
foreach ($data as $key => $value) {
if (property_exists($newMail, $key)) {
$newMail->{$key} = $value;
}
}
return $newMail;
}
}

View file

@ -45,11 +45,9 @@ class Emailer
*/
public function send(IEmail $email)
{
$params['sent'] = false;
Hook::callAll('emailer_send_prepare', $email);
Hook::callAll('emailer_send_prepare', $params);
if ($params['sent']) {
if (empty($email)) {
return true;
}