Fix assert() in lib
[MAILPOET-4258]
This commit is contained in:
@@ -12,7 +12,6 @@ use MailPoet\Entities\NewsletterEntity;
|
|||||||
use MailPoet\Entities\ScheduledTaskEntity;
|
use MailPoet\Entities\ScheduledTaskEntity;
|
||||||
use MailPoet\Entities\SubscriberEntity;
|
use MailPoet\Entities\SubscriberEntity;
|
||||||
use MailPoet\Logging\LoggerFactory;
|
use MailPoet\Logging\LoggerFactory;
|
||||||
use MailPoet\Mailer\MailerError;
|
|
||||||
use MailPoet\Mailer\MailerLog;
|
use MailPoet\Mailer\MailerLog;
|
||||||
use MailPoet\Mailer\MetaInfo;
|
use MailPoet\Mailer\MetaInfo;
|
||||||
use MailPoet\Models\Newsletter;
|
use MailPoet\Models\Newsletter;
|
||||||
@@ -423,7 +422,6 @@ class SendingQueue {
|
|||||||
// log error message and schedule retry/pause sending
|
// log error message and schedule retry/pause sending
|
||||||
if ($sendResult['response'] === false) {
|
if ($sendResult['response'] === false) {
|
||||||
$error = $sendResult['error'];
|
$error = $sendResult['error'];
|
||||||
assert($error instanceof MailerError);
|
|
||||||
$this->errorHandler->processError($error, $sendingTask, $preparedSubscribersIds, $preparedSubscribers);
|
$this->errorHandler->processError($error, $sendingTask, $preparedSubscribersIds, $preparedSubscribers);
|
||||||
} elseif (!$sendingTask->updateProcessedSubscribers($preparedSubscribersIds)) { // update processed/to process list
|
} elseif (!$sendingTask->updateProcessedSubscribers($preparedSubscribersIds)) { // update processed/to process list
|
||||||
MailerLog::processError(
|
MailerLog::processError(
|
||||||
|
@@ -3,8 +3,6 @@
|
|||||||
namespace MailPoet\Doctrine;
|
namespace MailPoet\Doctrine;
|
||||||
|
|
||||||
use MailPoetVendor\Doctrine\Common\Cache\CacheProvider;
|
use MailPoetVendor\Doctrine\Common\Cache\CacheProvider;
|
||||||
use MailPoetVendor\Doctrine\ORM\Mapping\ClassMetadata as DoctrineClassMetadata;
|
|
||||||
use MailPoetVendor\Symfony\Component\Validator\Mapping\ClassMetadata as ValidatorClassMetadata;
|
|
||||||
use ReflectionClass;
|
use ReflectionClass;
|
||||||
use ReflectionException;
|
use ReflectionException;
|
||||||
|
|
||||||
@@ -44,8 +42,7 @@ class MetadataCache extends CacheProvider {
|
|||||||
// in dev mode invalidate cache if source file has changed
|
// in dev mode invalidate cache if source file has changed
|
||||||
if ($fileExists && $this->isDevMode) {
|
if ($fileExists && $this->isDevMode) {
|
||||||
$classMetadata = unserialize((string)file_get_contents($filename));
|
$classMetadata = unserialize((string)file_get_contents($filename));
|
||||||
assert($classMetadata instanceof DoctrineClassMetadata || $classMetadata instanceof ValidatorClassMetadata);
|
if (!isset($classMetadata->name) || (!class_exists($classMetadata->name) && !interface_exists($classMetadata->name))) {
|
||||||
if (!class_exists($classMetadata->name) && !interface_exists($classMetadata->name)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@@ -101,12 +101,16 @@ class Bridge {
|
|||||||
return $wp->wpRemoteRetrieveResponseCode($result) === 200;
|
return $wp->wpRemoteRetrieveResponseCode($result) === 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return API
|
||||||
|
*/
|
||||||
public function initApi($apiKey) {
|
public function initApi($apiKey) {
|
||||||
if ($this->api) {
|
if ($this->api instanceof API) {
|
||||||
$this->api->setKey($apiKey);
|
$this->api->setKey($apiKey);
|
||||||
} else {
|
} else {
|
||||||
$this->api = new Bridge\API($apiKey);
|
$this->api = new Bridge\API($apiKey);
|
||||||
}
|
}
|
||||||
|
return $this->api;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -114,9 +118,7 @@ class Bridge {
|
|||||||
* @return API
|
* @return API
|
||||||
*/
|
*/
|
||||||
public function getApi($key) {
|
public function getApi($key) {
|
||||||
$this->initApi($key);
|
return $this->initApi($key);
|
||||||
assert($this->api instanceof API);
|
|
||||||
return $this->api;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAuthorizedEmailAddresses($type = 'authorized'): array {
|
public function getAuthorizedEmailAddresses($type = 'authorized'): array {
|
||||||
|
Reference in New Issue
Block a user