Fix code review syntax remarks [MAILPOET-903]
This commit is contained in:
@ -9,7 +9,8 @@ class CronTrigger {
|
|||||||
public $current_method;
|
public $current_method;
|
||||||
public static $available_methods = array(
|
public static $available_methods = array(
|
||||||
'mailpoet' => 'MailPoet',
|
'mailpoet' => 'MailPoet',
|
||||||
'wordpress' => 'WordPress'
|
'wordpress' => 'WordPress',
|
||||||
|
'none' => 'Disabled'
|
||||||
);
|
);
|
||||||
const DEFAULT_METHOD = 'WordPress';
|
const DEFAULT_METHOD = 'WordPress';
|
||||||
const SETTING_NAME = 'cron_trigger';
|
const SETTING_NAME = 'cron_trigger';
|
||||||
|
@ -83,7 +83,7 @@ class Migration extends SimpleWorker {
|
|||||||
|
|
||||||
static function checkUnmigratedColumnsExist() {
|
static function checkUnmigratedColumnsExist() {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
$existing_columns = $wpdb->get_col('DESC ' . SendingQueue::$_table, 0);
|
$existing_columns = $wpdb->get_col('DESC ' . SendingQueue::$_table);
|
||||||
return in_array('type', $existing_columns);
|
return in_array('type', $existing_columns);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,8 +83,6 @@ class MailerLog {
|
|||||||
self::updateMailerLog($mailer_log);
|
self::updateMailerLog($mailer_log);
|
||||||
if($pause_sending) {
|
if($pause_sending) {
|
||||||
self::pauseSending($mailer_log);
|
self::pauseSending($mailer_log);
|
||||||
} else {
|
|
||||||
self::updateMailerLog($mailer_log);
|
|
||||||
}
|
}
|
||||||
return self::enforceExecutionRequirements();
|
return self::enforceExecutionRequirements();
|
||||||
}
|
}
|
||||||
|
@ -533,7 +533,7 @@ class Newsletter extends Model {
|
|||||||
} else {
|
} else {
|
||||||
$row = $statisticsExpr
|
$row = $statisticsExpr
|
||||||
->join(MP_SENDING_QUEUES_TABLE, array("queue_id", "=", "qt.id"), "qt")
|
->join(MP_SENDING_QUEUES_TABLE, array("queue_id", "=", "qt.id"), "qt")
|
||||||
->join(MP_SCHEDULED_TASKS_TABLE, array("qt.task_Id", "=", "tasks.id"), "tasks")
|
->join(MP_SCHEDULED_TASKS_TABLE, array("qt.task_id", "=", "tasks.id"), "tasks")
|
||||||
->where(array(
|
->where(array(
|
||||||
"tasks.status" => SendingQueue::STATUS_COMPLETED,
|
"tasks.status" => SendingQueue::STATUS_COMPLETED,
|
||||||
"stat.newsletter_id" => $this->id,
|
"stat.newsletter_id" => $this->id,
|
||||||
|
@ -95,8 +95,8 @@ class SendingQueue extends Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isSubscriberProcessed($subscriber_id) {
|
function isSubscriberProcessed($subscriber_id) {
|
||||||
return (new TaskSubscribers($this->task()->findOne()))
|
$task_subscribers = new TaskSubscribers($this->task()->findOne());
|
||||||
->isSubscriberProcessed($subscriber_id);
|
return $task_subscribers->isSubscriberProcessed($subscriber_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
function asArray() {
|
function asArray() {
|
||||||
|
@ -101,7 +101,7 @@ class SubscribersFinder {
|
|||||||
Subscriber::STATUS_SUBSCRIBED
|
Subscriber::STATUS_SUBSCRIBED
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
return \ORM::get_last_statement()->rowCount();
|
return \ORM::getLastStatement()->rowCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function addSubscribersToTaskFromDynamicSegments(ScheduledTask $task, array $segments) {
|
private function addSubscribersToTaskFromDynamicSegments(ScheduledTask $task, array $segments) {
|
||||||
@ -139,7 +139,7 @@ class SubscribersFinder {
|
|||||||
Subscriber::STATUS_SUBSCRIBED
|
Subscriber::STATUS_SUBSCRIBED
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
return \ORM::get_last_statement()->rowCount();
|
return \ORM::getLastStatement()->rowCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function unique($subscribers) {
|
private function unique($subscribers) {
|
||||||
|
@ -18,7 +18,8 @@ class CronTriggerTest extends \MailPoetTest {
|
|||||||
expect(CronTrigger::$available_methods)->equals(
|
expect(CronTrigger::$available_methods)->equals(
|
||||||
array(
|
array(
|
||||||
'mailpoet' => 'MailPoet',
|
'mailpoet' => 'MailPoet',
|
||||||
'wordpress' => 'WordPress'
|
'wordpress' => 'WordPress',
|
||||||
|
'none' => 'Disabled'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ class SendingTest extends \MailPoetTest {
|
|||||||
expect($this->sending->count_processed)->equals(1);
|
expect($this->sending->count_processed)->equals(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testItGetsSchedulesQueues() {
|
function testItGetsScheduledQueues() {
|
||||||
$this->sending->status = ScheduledTask::STATUS_SCHEDULED;
|
$this->sending->status = ScheduledTask::STATUS_SCHEDULED;
|
||||||
$this->sending->scheduled_at = Carbon::createFromTimestamp(current_time('timestamp'))->subHours(1);
|
$this->sending->scheduled_at = Carbon::createFromTimestamp(current_time('timestamp'))->subHours(1);
|
||||||
$this->sending->save();
|
$this->sending->save();
|
||||||
|
Reference in New Issue
Block a user