Reactivate all inactive subscribers when inactive interval is set to never

[MAILPOET-2003]
This commit is contained in:
Rostislav Wolny
2019-04-24 09:11:56 +02:00
committed by M. Shull
parent e5f5b3534c
commit f5d154d680
4 changed files with 35 additions and 3 deletions

View File

@ -30,12 +30,19 @@ class InactiveSubscribers extends SimpleWorker {
function processTaskStrategy(ScheduledTask $task) {
$days_to_inactive = (int)$this->settings->get('deactivate_subscriber_after_inactive_days');
$tracking_enabled = (bool)$this->settings->get('tracking.enabled');
if ($days_to_inactive === 0 || !$tracking_enabled) {
if (!$tracking_enabled) {
self::schedule();
return true;
}
$days_to_inactive = (int)$this->settings->get('deactivate_subscriber_after_inactive_days');
// Activate all inactive subscribers in case the feature is turned off
if ($days_to_inactive === 0) {
$this->inactive_subscribers_controller->reactivateInactiveSubscribers();
self::schedule();
return true;
}
// Handle activation/deactivation within interval
while ($this->inactive_subscribers_controller->markInactiveSubscribers($days_to_inactive, self::BATCH_SIZE) === self::BATCH_SIZE) {
CronHelper::enforceExecutionLimit($this->timer);
};