diff --git a/protected/humhub/modules/activity/Events.php b/protected/humhub/modules/activity/Events.php index fbc6c3b779..01491a6aad 100644 --- a/protected/humhub/modules/activity/Events.php +++ b/protected/humhub/modules/activity/Events.php @@ -9,8 +9,8 @@ namespace humhub\modules\activity; use Yii; -use humhub\modules\activity\components\MailSummaryProcessor; use humhub\modules\activity\components\MailSummary; +use humhub\modules\activity\jobs\SendMailSummary; use humhub\modules\activity\models\Activity; /** @@ -29,9 +29,9 @@ class Events extends \yii\base\Object public static function onCronRun($event) { if (Yii::$app->controller->action->id == 'hourly') { - MailSummaryProcessor::process(MailSummary::INTERVAL_HOURY); + Yii::$app->queue->push(new SendMailSummary(['interval' => MailSummary::INTERVAL_HOURY])); } elseif (Yii::$app->controller->action->id == 'daily') { - MailSummaryProcessor::process(MailSummary::INTERVAL_DAILY); + Yii::$app->queue->push(new SendMailSummary(['interval' => MailSummary::INTERVAL_DAILY])); } } diff --git a/protected/humhub/modules/activity/jobs/SendMailSummary.php b/protected/humhub/modules/activity/jobs/SendMailSummary.php new file mode 100644 index 0000000000..2c1a7660e5 --- /dev/null +++ b/protected/humhub/modules/activity/jobs/SendMailSummary.php @@ -0,0 +1,43 @@ +interval === MailSummary::INTERVAL_DAILY || $this->interval === MailSummary::INTERVAL_HOURY) { + MailSummaryProcessor::process($this->interval); + } else { + Yii::error('Invalid summary interval given'. $this->interval, 'activity.job'); + return; + } + } + +}