Files
piratepoet/lib/Router/Endpoints/CronDaemon.php
Vlad a6b00e1ba7 - Adds new "ping" cron daemon router endpoint
- Removes the requirement to have data payload for router requests
2017-01-08 22:25:39 -05:00

38 lines
707 B
PHP

<?php
namespace MailPoet\Router\Endpoints;
use MailPoet\Cron\CronHelper;
use MailPoet\Cron\Daemon;
if(!defined('ABSPATH')) exit;
class CronDaemon {
const ENDPOINT = 'cron_daemon';
const ACTION_RUN = 'run';
const ACTION_PING = 'ping';
const ACTION_PING_RESPONSE = 'pingResponse';
public $allowed_actions = array(
self::ACTION_RUN,
self::ACTION_PING,
self::ACTION_PING_RESPONSE
);
public $data;
function __construct($data) {
$this->data = $data;
}
function run() {
$queue = new Daemon($this->data);
$queue->run();
}
function ping() {
die(CronHelper::pingDaemon());
}
function pingResponse() {
$queue = new Daemon();
$queue->ping();
}
}