Revert "Migrate subscribers for all tasks types [MAILPOET-903]"
This reverts commit f1f69c9835
.
This commit is contained in:
@ -96,7 +96,7 @@ class Migration extends SimpleWorker {
|
|||||||
global $wpdb;
|
global $wpdb;
|
||||||
$query = sprintf(
|
$query = sprintf(
|
||||||
'SELECT queues.`task_id` FROM %1$s queues INNER JOIN %2$s tasks ON queues.`task_id` = tasks.`id` ' .
|
'SELECT queues.`task_id` FROM %1$s queues INNER JOIN %2$s tasks ON queues.`task_id` = tasks.`id` ' .
|
||||||
'WHERE tasks.`type` = "sending" ' .
|
'WHERE tasks.`type` = "sending" AND (tasks.`status` IS NULL OR tasks.`status` = "paused") ' .
|
||||||
'AND queues.`subscribers` != "" AND queues.`subscribers` != "N;"' .
|
'AND queues.`subscribers` != "" AND queues.`subscribers` != "N;"' .
|
||||||
'AND queues.`count_total` > (SELECT COUNT(*) FROM %3$s subs WHERE subs.`task_id` = queues.`task_id`)',
|
'AND queues.`count_total` > (SELECT COUNT(*) FROM %3$s subs WHERE subs.`task_id` = queues.`task_id`)',
|
||||||
MP_SENDING_QUEUES_TABLE,
|
MP_SENDING_QUEUES_TABLE,
|
||||||
|
@ -31,6 +31,8 @@ class MigrationTest extends \MailPoetTest {
|
|||||||
// subscribers should be migrated
|
// subscribers should be migrated
|
||||||
$this->queue_running = $this->createSendingQueue();
|
$this->queue_running = $this->createSendingQueue();
|
||||||
$this->queue_paused = $this->createSendingQueue(SendingQueue::STATUS_PAUSED);
|
$this->queue_paused = $this->createSendingQueue(SendingQueue::STATUS_PAUSED);
|
||||||
|
|
||||||
|
// subscribers should not be migrated
|
||||||
$this->queue_completed = $this->createSendingQueue(SendingQueue::STATUS_COMPLETED);
|
$this->queue_completed = $this->createSendingQueue(SendingQueue::STATUS_COMPLETED);
|
||||||
$this->queue_scheduled = $this->createSendingQueue(SendingQueue::STATUS_SCHEDULED);
|
$this->queue_scheduled = $this->createSendingQueue(SendingQueue::STATUS_SCHEDULED);
|
||||||
|
|
||||||
@ -83,7 +85,7 @@ class MigrationTest extends \MailPoetTest {
|
|||||||
|
|
||||||
expect($this->worker->getUnmigratedQueues()->count())->equals(0);
|
expect($this->worker->getUnmigratedQueues()->count())->equals(0);
|
||||||
expect(ScheduledTask::where('type', SendingTask::TASK_TYPE)->findMany())->count(4);
|
expect(ScheduledTask::where('type', SendingTask::TASK_TYPE)->findMany())->count(4);
|
||||||
expect(ScheduledTaskSubscriber::whereGt('task_id', 0)->count())->equals(8); // 2 for task of each status
|
expect(ScheduledTaskSubscriber::whereGt('task_id', 0)->count())->equals(4); // 2 for running, 2 for paused
|
||||||
|
|
||||||
$queue = SendingQueue::findOne($this->queue_running->id);
|
$queue = SendingQueue::findOne($this->queue_running->id);
|
||||||
$task = ScheduledTask::findOne($queue->task_id);
|
$task = ScheduledTask::findOne($queue->task_id);
|
||||||
|
Reference in New Issue
Block a user