Uname: Linux webm012.cluster130.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
Software: Apache
PHP version: 8.0.30 [ PHP INFO ] PHP os: Linux
Server Ip: 145.239.37.162
Your Ip: 216.73.216.190
User: dreampi (1009562) | Group: users (100)
Safe Mode: OFF
Disable Function:
_dyuweyrj4,_dyuweyrj4r,dl

name : BackfillEngagementData.php
<?php declare(strict_types = 1);

namespace MailPoet\Cron\Workers;

if (!defined('ABSPATH')) exit;


use MailPoet\Entities\ScheduledTaskEntity;
use MailPoet\Subscribers\EngagementDataBackfiller;

class BackfillEngagementData extends SimpleWorker {
  const TASK_TYPE = 'backfill_engagement_data';
  const BATCH_SIZE = 100;
  const AUTOMATIC_SCHEDULING = false;
  const SUPPORT_MULTIPLE_INSTANCES = false;

  /** @var EngagementDataBackfiller */
  private $engagementDataBackfiller;

  public function __construct(
    EngagementDataBackfiller $engagementDataBackfiller
  ) {
    parent::__construct();
    $this->engagementDataBackfiller = $engagementDataBackfiller;
  }

  public function processTaskStrategy(ScheduledTaskEntity $task, $timer) {
    $meta = $task->getMeta();

    $lastSubscriberId = $meta['last_subscriber_id'] ?? 0;

    do {
      $this->cronHelper->enforceExecutionLimit($timer);
      $batch = $this->engagementDataBackfiller->getBatch($lastSubscriberId, self::BATCH_SIZE);
      if (empty($batch)) {
        break;
      }
      $this->engagementDataBackfiller->updateBatch($batch);
      $lastSubscriberId = $this->engagementDataBackfiller->getLastProcessedSubscriberId();
      $meta['last_subscriber_id'] = $lastSubscriberId;
      $task->setMeta($meta);
      $this->scheduledTasksRepository->persist($task);
      $this->scheduledTasksRepository->flush();
    } while (count($batch) === self::BATCH_SIZE);

    return true;
  }
}
© 2026 GrazzMean-Shell