Add space between if and ‘(‘
[MAILPOET-1791]
This commit is contained in:
@ -10,7 +10,7 @@ use MailPoet\Models\ScheduledTaskSubscriber;
|
||||
use MailPoet\Models\SendingQueue;
|
||||
use MailPoet\WP\Functions as WPFunctions;
|
||||
|
||||
if(!defined('ABSPATH')) exit;
|
||||
if (!defined('ABSPATH')) exit;
|
||||
|
||||
class Migration extends SimpleWorker {
|
||||
const TASK_TYPE = 'migration';
|
||||
@ -27,12 +27,12 @@ class Migration extends SimpleWorker {
|
||||
$unmigrated_queues_count = 0;
|
||||
$unmigrated_queue_subscribers = [];
|
||||
|
||||
if($unmigrated_columns) {
|
||||
if ($unmigrated_columns) {
|
||||
$unmigrated_queues_count = $this->getUnmigratedQueues()->count();
|
||||
$unmigrated_queue_subscribers = $this->getTaskIdsForUnmigratedSubscribers();
|
||||
}
|
||||
|
||||
if(!$unmigrated_columns ||
|
||||
if (!$unmigrated_columns ||
|
||||
($unmigrated_queues_count == 0
|
||||
&& count($unmigrated_queue_subscribers) == 0)
|
||||
) {
|
||||
@ -50,7 +50,7 @@ class Migration extends SimpleWorker {
|
||||
|
||||
function pauseSending() {
|
||||
$mailer_log = MailerLog::getMailerLog();
|
||||
if(MailerLog::isSendingPaused($mailer_log)) {
|
||||
if (MailerLog::isSendingPaused($mailer_log)) {
|
||||
// sending is already paused
|
||||
return false;
|
||||
}
|
||||
@ -64,13 +64,13 @@ class Migration extends SimpleWorker {
|
||||
|
||||
function resumeSending() {
|
||||
$mailer_log = MailerLog::getMailerLog();
|
||||
if(!MailerLog::isSendingPaused($mailer_log)) {
|
||||
if (!MailerLog::isSendingPaused($mailer_log)) {
|
||||
// sending is not paused
|
||||
return false;
|
||||
}
|
||||
$error = MailerLog::getError($mailer_log);
|
||||
// only resume sending if it was paused by migration
|
||||
if(isset($error['operation']) && $error['operation'] === 'migration') {
|
||||
if (isset($error['operation']) && $error['operation'] === 'migration') {
|
||||
return MailerLog::resumeSending();
|
||||
}
|
||||
}
|
||||
@ -130,7 +130,7 @@ class Migration extends SimpleWorker {
|
||||
'deleted_at'
|
||||
);
|
||||
|
||||
if(!empty($queues)) {
|
||||
if (!empty($queues)) {
|
||||
foreach (array_chunk($queues, self::BATCH_SIZE) as $queue_batch) {
|
||||
// abort if execution limit is reached
|
||||
CronHelper::enforceExecutionLimit($this->timer);
|
||||
@ -170,7 +170,7 @@ class Migration extends SimpleWorker {
|
||||
$task_ids = $this->getTaskIdsForUnmigratedSubscribers();
|
||||
|
||||
// check if subscribers for each one were already migrated
|
||||
if(!empty($task_ids)) {
|
||||
if (!empty($task_ids)) {
|
||||
$task_ids = $wpdb->get_col(sprintf(
|
||||
'SELECT queues.`task_id` FROM %1$s queues WHERE queues.`task_id` IN(' . join(',', array_map('intval', $task_ids)) . ') ' .
|
||||
'AND queues.`count_total` > (SELECT COUNT(*) FROM %2$s subs WHERE subs.`task_id` = queues.`task_id`)',
|
||||
@ -179,7 +179,7 @@ class Migration extends SimpleWorker {
|
||||
));
|
||||
}
|
||||
|
||||
if(!empty($task_ids)) {
|
||||
if (!empty($task_ids)) {
|
||||
foreach ($task_ids as $task_id) {
|
||||
// abort if execution limit is reached
|
||||
CronHelper::enforceExecutionLimit($this->timer);
|
||||
@ -207,13 +207,13 @@ class Migration extends SimpleWorker {
|
||||
));
|
||||
|
||||
// sanity check
|
||||
if(empty($subscribers)) {
|
||||
if (empty($subscribers)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$subscribers = unserialize($subscribers);
|
||||
|
||||
if(!empty($subscribers['to_process'])) {
|
||||
if (!empty($subscribers['to_process'])) {
|
||||
$subscribers_to_migrate = array_slice($subscribers['to_process'], $migrated_unprocessed_count);
|
||||
foreach ($subscribers_to_migrate as $sub_id) {
|
||||
// abort if execution limit is reached
|
||||
@ -227,7 +227,7 @@ class Migration extends SimpleWorker {
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($subscribers['processed'])) {
|
||||
if (!empty($subscribers['processed'])) {
|
||||
$subscribers_to_migrate = array_slice($subscribers['processed'], $migrated_processed_count);
|
||||
foreach ($subscribers_to_migrate as $sub_id) {
|
||||
// abort if execution limit is reached
|
||||
@ -245,7 +245,7 @@ class Migration extends SimpleWorker {
|
||||
}
|
||||
|
||||
static function getNextRunDate($wp = null) {
|
||||
if(is_null($wp)) {
|
||||
if (is_null($wp)) {
|
||||
$wp = new WPFunctions();
|
||||
}
|
||||
// run migration immediately
|
||||
|
Reference in New Issue
Block a user