Use DI for cron triggers

[MAILPOET-2538]
This commit is contained in:
Jan Jakeš
2019-11-18 10:03:22 +01:00
committed by Jack Kitterhing
parent 7a91641d11
commit c1d5c8068d
5 changed files with 78 additions and 31 deletions

View File

@ -23,13 +23,17 @@ class DaemonHttpRunner {
const PING_SUCCESS_RESPONSE = 'pong';
function __construct(Daemon $daemon = null, CronHelper $cron_helper, SettingsController $settings) {
/** @var WordPress */
private $wordpress_trigger;
function __construct(Daemon $daemon = null, CronHelper $cron_helper, SettingsController $settings, WordPress $wordpress_trigger) {
$this->cron_helper = $cron_helper;
$this->settings_daemon_data = $this->cron_helper->getDaemon();
$this->token = $this->cron_helper->createToken();
$this->timer = microtime(true);
$this->daemon = $daemon;
$this->settings = $settings;
$this->wordpress_trigger = $wordpress_trigger;
}
function ping() {
@ -113,11 +117,11 @@ class DaemonHttpRunner {
}
function checkWPTriggerExecutionRequirements() {
return WordPress::checkExecutionRequirements();
return $this->wordpress_trigger->checkExecutionRequirements();
}
function stopCron() {
return WordPress::stop();
return $this->wordpress_trigger->stop();
}
/**