Server IP : 104.21.14.103 / Your IP : 18.117.100.82 Web Server : LiteSpeed System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : giankuin ( 1871) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/home/giankuin/thietke365.net/wp-content/plugins/mailpoet/lib/Cron/ |
Upload File : |
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing 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; } }