Refactor MailPoet\Cron to use new settings

[MAILPOET-1757]
This commit is contained in:
Rostislav Wolny
2019-01-30 13:57:18 +01:00
parent 6e79705128
commit ff238bf69a
21 changed files with 174 additions and 86 deletions

View File

@@ -2,6 +2,7 @@
namespace MailPoet\Cron;
use MailPoet\Models\Setting;
use MailPoet\Settings\SettingsController;
if(!defined('ABSPATH')) exit;
@@ -16,8 +17,8 @@ class CronTrigger {
const DEFAULT_METHOD = 'WordPress';
const SETTING_NAME = 'cron_trigger';
function __construct() {
$this->current_method = self::getCurrentMethod();
function __construct(SettingsController $settingsController) {
$this->current_method = $settingsController->get(self::SETTING_NAME . '.method');
}
function init() {
@@ -34,8 +35,4 @@ class CronTrigger {
static function getAvailableMethods() {
return self::$available_methods;
}
static function getCurrentMethod() {
return Setting::getValue(self::SETTING_NAME . '.method');
}
}