Update last announcement date automatically

This commit is contained in:
Amine Ben hammou
2019-06-20 20:07:30 +01:00
committed by M. Shull
parent 2fe193d5d9
commit d980f9e3f4
5 changed files with 53 additions and 15 deletions

View File

@@ -5,6 +5,7 @@ use Carbon\Carbon;
use MailPoet\Config\PopulatorData\DefaultForm;
use MailPoet\Cron\CronTrigger;
use MailPoet\Cron\Workers\AuthorizedSendingEmailsCheck;
use MailPoet\Cron\Workers\Beamer;
use MailPoet\Cron\Workers\InactiveSubscribers;
use MailPoet\Mailer\MailerLog;
use MailPoet\Models\NewsletterTemplate;
@@ -139,6 +140,7 @@ class Populator {
$this->updateMetaFields();
$this->scheduleInitialInactiveSubscribersCheck();
$this->scheduleAuthorizedSendingEmailsCheck();
$this->initLastAnnouncementDate();
// Will be uncommented on task [MAILPOET-1998]
// $this->updateFormsSuccessMessages();
}
@@ -549,6 +551,13 @@ class Populator {
);
}
private function initLastAnnouncementDate() {
if (!$this->settings->get('last_announcement_date')) {
$beamer = new Beamer($this->settings);
$beamer->setLastAnnouncementDate();
}
}
private function scheduleTask($type, $datetime) {
$task = ScheduledTask::where('type', $type)
->whereRaw('status = ? OR status IS NULL', [ScheduledTask::STATUS_SCHEDULED])