Revert "Migrate subscribers for all tasks types [MAILPOET-903]"

This reverts commit f1f69c9835.
This commit is contained in:
stoletniy
2018-03-01 21:17:40 +03:00
parent f1f69c9835
commit e0f989f6a8
2 changed files with 4 additions and 2 deletions

View File

@ -96,7 +96,7 @@ class Migration extends SimpleWorker {
global $wpdb;
$query = sprintf(
'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.`count_total` > (SELECT COUNT(*) FROM %3$s subs WHERE subs.`task_id` = queues.`task_id`)',
MP_SENDING_QUEUES_TABLE,

View File

@ -31,6 +31,8 @@ class MigrationTest extends \MailPoetTest {
// subscribers should be migrated
$this->queue_running = $this->createSendingQueue();
$this->queue_paused = $this->createSendingQueue(SendingQueue::STATUS_PAUSED);
// subscribers should not be migrated
$this->queue_completed = $this->createSendingQueue(SendingQueue::STATUS_COMPLETED);
$this->queue_scheduled = $this->createSendingQueue(SendingQueue::STATUS_SCHEDULED);
@ -83,7 +85,7 @@ class MigrationTest extends \MailPoetTest {
expect($this->worker->getUnmigratedQueues()->count())->equals(0);
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);
$task = ScheduledTask::findOne($queue->task_id);