Simplify CronTrigger methods list & its usage
[MAILPOET-2538]
This commit is contained in:
committed by
Jack Kitterhing
parent
69b79b4f6c
commit
b1aed487be
@@ -76,7 +76,7 @@ class Settings {
|
||||
$data = [
|
||||
'settings' => $settings,
|
||||
'segments' => Segment::getSegmentsWithSubscriberCount(),
|
||||
'cron_trigger' => CronTrigger::getAvailableMethods(),
|
||||
'cron_trigger' => CronTrigger::METHODS,
|
||||
'total_subscribers' => Subscriber::getTotalSubscribers(),
|
||||
'premium_plugin_active' => License::getLicense(),
|
||||
'premium_key_valid' => !empty($premium_key_valid),
|
||||
|
@@ -30,7 +30,7 @@ class Reporter {
|
||||
global $wpdb, $wp_version, $woocommerce;
|
||||
$mta = $this->settings->get('mta', []);
|
||||
$newsletters = Newsletter::getAnalytics();
|
||||
$isCronTriggerMethodWP = $this->settings->get('cron_trigger.method') === CronTrigger::$available_methods['wordpress'];
|
||||
$isCronTriggerMethodWP = $this->settings->get('cron_trigger.method') === CronTrigger::METHOD_WORDPRESS;
|
||||
$checker = new ServicesChecker();
|
||||
$bounceAddress = $this->settings->get('bounce.address');
|
||||
$segments = Segment::getAnalytics();
|
||||
|
@@ -12,12 +12,13 @@ class CronTrigger {
|
||||
const METHOD_MAILPOET = 'MailPoet';
|
||||
const METHOD_WORDPRESS = 'WordPress';
|
||||
|
||||
public static $available_methods = [
|
||||
const METHODS = [
|
||||
'mailpoet' => self::METHOD_MAILPOET,
|
||||
'wordpress' => self::METHOD_WORDPRESS,
|
||||
'linux_cron' => self::METHOD_LINUX_CRON,
|
||||
'none' => 'Disabled',
|
||||
];
|
||||
|
||||
const DEFAULT_METHOD = 'WordPress';
|
||||
const SETTING_NAME = 'cron_trigger';
|
||||
|
||||
@@ -36,8 +37,4 @@ class CronTrigger {
|
||||
// cron exceptions should not prevent the rest of the site from loading
|
||||
}
|
||||
}
|
||||
|
||||
static function getAvailableMethods() {
|
||||
return self::$available_methods;
|
||||
}
|
||||
}
|
||||
|
@@ -109,8 +109,7 @@ class DaemonHttpRunner {
|
||||
}
|
||||
|
||||
function isCronTriggerMethodWordPress() {
|
||||
$available_methods = CronTrigger::getAvailableMethods();
|
||||
return $this->settings->get(CronTrigger::SETTING_NAME . '.method') === $available_methods['wordpress'];
|
||||
return $this->settings->get(CronTrigger::SETTING_NAME . '.method') === CronTrigger::METHOD_WORDPRESS;
|
||||
}
|
||||
|
||||
function checkWPTriggerExecutionRequirements() {
|
||||
|
@@ -34,11 +34,6 @@ class CronTriggerTest extends \MailPoetTest {
|
||||
);
|
||||
}
|
||||
|
||||
function testItCanReturnAvailableMethods() {
|
||||
expect($this->cron_trigger->getAvailableMethods())
|
||||
->equals(CronTrigger::$available_methods);
|
||||
}
|
||||
|
||||
function testItCanInitializeCronTriggerMethod() {
|
||||
$settings_mock = Stub::makeEmpty(
|
||||
SettingsController::class,
|
||||
|
Reference in New Issue
Block a user