From 2fe193d5d9de018331df06a16563318942e2e378 Mon Sep 17 00:00:00 2001 From: Amine Ben hammou Date: Thu, 20 Jun 2019 15:43:26 +0100 Subject: [PATCH] Add Beamer Worker --- lib/Cron/Daemon.php | 1 + lib/Cron/Workers/Beamer.php | 34 +++++++++++++++++++++++++++++ lib/Cron/Workers/WorkersFactory.php | 5 +++++ 3 files changed, 40 insertions(+) create mode 100644 lib/Cron/Workers/Beamer.php diff --git a/lib/Cron/Daemon.php b/lib/Cron/Daemon.php index 1a5bf8758f..eeeb1ed67b 100644 --- a/lib/Cron/Daemon.php +++ b/lib/Cron/Daemon.php @@ -51,6 +51,7 @@ class Daemon { yield $this->workers_factory->createPremiumKeyCheckWorker($this->timer); yield $this->workers_factory->createBounceWorker($this->timer); yield $this->workers_factory->createExportFilesCleanupWorker($this->timer); + yield $this->workers_factory->createBeamerkWorker($this->timer); yield $this->workers_factory->createInactiveSubscribersWorker($this->timer); yield $this->workers_factory->createWooCommerceSyncWorker($this->timer); yield $this->workers_factory->createAuthorizedSendingEmailsCheckWorker($this->timer); diff --git a/lib/Cron/Workers/Beamer.php b/lib/Cron/Workers/Beamer.php new file mode 100644 index 0000000000..8baba8d370 --- /dev/null +++ b/lib/Cron/Workers/Beamer.php @@ -0,0 +1,34 @@ +settings = $settings; + } + + function processTaskStrategy(ScheduledTask $task) { + $this->settings->set('last_announcement_date', 'timestamp'); + return true; + } + + // static function getNextRunDate() { + // $wp = new WPFunctions(); + // $date = Carbon::createFromTimestamp($wp->currentTime('timestamp')); + // return $date->addMinute(); + // // return $date->hour(11)->minute(00)->second(00)->addDay(); + // } +} diff --git a/lib/Cron/Workers/WorkersFactory.php b/lib/Cron/Workers/WorkersFactory.php index 3418a68e47..970d2ea4ef 100644 --- a/lib/Cron/Workers/WorkersFactory.php +++ b/lib/Cron/Workers/WorkersFactory.php @@ -135,6 +135,11 @@ class WorkersFactory { return new ExportFilesCleanup($timer); } + /** @return Beamer */ + function createBeamerWorker($timer) { + return new Beamer($this->settings, $timer); + } + /** @return InactiveSubscribers */ function createInactiveSubscribersWorker($timer) { return new InactiveSubscribers($this->inactive_subscribers_controller, $this->settings, $timer);