PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /home/trave494/allintravelguide.kerihosting.com/wp-content/plugins/mailpoet/lib/Cron/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : /home/trave494/allintravelguide.kerihosting.com/wp-content/plugins/mailpoet/lib/Cron/Supervisor.php

<?php

namespace MailPoet\Cron;

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


class Supervisor {
  public $daemon;
  public $token;

  /** @var CronHelper */
  private $cronHelper;

  public function __construct(CronHelper $cronHelper) {
    $this->cronHelper = $cronHelper;
  }

  public function init() {
    $this->token = $this->cronHelper->createToken();
    $this->daemon = $this->getDaemon();
  }

  public function checkDaemon() {
    $daemon = $this->daemon;
    $updatedAt = $daemon ? (int)$daemon['updated_at'] : 0;
    $executionTimeoutExceeded =
      (time() - $updatedAt) >= $this->cronHelper->getDaemonExecutionTimeout();
    $daemonIsInactive =
      isset($daemon['status']) && $daemon['status'] === CronHelper::DAEMON_STATUS_INACTIVE;
    if ($executionTimeoutExceeded || $daemonIsInactive) {
      $this->cronHelper->restartDaemon($this->token);
      return $this->runDaemon();
    }
    return $daemon;
  }

  public function runDaemon() {
    $this->cronHelper->accessDaemon($this->token);
    $daemon = $this->cronHelper->getDaemon();
    return $daemon;
  }

  public function getDaemon() {
    $daemon = $this->cronHelper->getDaemon();
    if (!$daemon) {
      $this->cronHelper->createDaemon($this->token);
      return $this->runDaemon();
    }
    return $daemon;
  }
}