Files
piratepoet/lib/Tasks/Bounce.php
Rodrigo Primo 57c80ea763 Change SimpleWorker::prepareTaskStrategy() to use Doctrine
This commit changes the method prepareTaskStrategy() in the class
SimpleWorker and all its child classes to use ScheduledTaskEntity
instead of ScheduledTask.

[MAILPOET-2996]
2021-10-04 13:25:44 +02:00

28 lines
816 B
PHP

<?php
namespace MailPoet\Tasks;
use MailPoet\Entities\ScheduledTaskEntity;
use MailPoet\Models\ScheduledTaskSubscriber;
use MailPoet\Models\Subscriber;
class Bounce {
public static function prepareSubscribers(ScheduledTaskEntity $task) {
// Prepare subscribers on the DB side for performance reasons
Subscriber::rawExecute(
'INSERT IGNORE INTO ' . MP_SCHEDULED_TASK_SUBSCRIBERS_TABLE . '
(task_id, subscriber_id, processed)
SELECT ? as task_id, s.`id` as subscriber_id, ? as processed
FROM ' . MP_SUBSCRIBERS_TABLE . ' s
WHERE s.`deleted_at` IS NULL
AND s.`status` IN (?, ?)',
[
$task->getId(),
ScheduledTaskSubscriber::STATUS_UNPROCESSED,
Subscriber::STATUS_SUBSCRIBED,
Subscriber::STATUS_UNCONFIRMED,
]
);
}
}