- Resolves an issue with cron not starting
This commit is contained in:
@ -20,7 +20,7 @@ class PublicAPI {
|
||||
Helpers::underscoreToCamelCase($_GET['action']) :
|
||||
false;
|
||||
$this->request_payload = isset($_GET['request_payload']) ?
|
||||
json_decode(urldecode($_GET['request_payload']), true) :
|
||||
unserialize(base64_decode($_GET['request_payload'])) :
|
||||
false;
|
||||
}
|
||||
|
||||
|
@ -112,23 +112,27 @@ class Daemon {
|
||||
|
||||
function manageSession($action) {
|
||||
switch($action) {
|
||||
case 'start':
|
||||
if(session_id()) {
|
||||
case 'start':
|
||||
if(session_id()) {
|
||||
session_write_close();
|
||||
}
|
||||
session_id($this->request_payload['session']);
|
||||
session_start();
|
||||
if (!isset($_SESSION['cron_daemon'])) {
|
||||
throw new \Exception(__('Session cannot be read.'));
|
||||
}
|
||||
break;
|
||||
case 'end':
|
||||
session_write_close();
|
||||
}
|
||||
session_id($this->request_payload['session']);
|
||||
session_start();
|
||||
break;
|
||||
case 'end':
|
||||
session_write_close();
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function callSelf() {
|
||||
$payload = json_encode(array('token' => $this->refreshed_token));
|
||||
$payload = serialize(array('token' => $this->refreshed_token));
|
||||
Supervisor::accessRemoteUrl(
|
||||
'/?mailpoet-api§ion=queue&action=run&request_payload=' . urlencode($payload)
|
||||
'/?mailpoet-api§ion=queue&action=run&request_payload=' .
|
||||
base64_encode($payload)
|
||||
);
|
||||
exit;
|
||||
}
|
||||
|
@ -51,12 +51,15 @@ class Supervisor {
|
||||
$sessionId = session_id();
|
||||
session_write_close();
|
||||
$_SESSION['cron_daemon'] = null;
|
||||
$requestPayload = json_encode(array('session' => $sessionId));
|
||||
$requestPayload = serialize(array('session' => $sessionId));
|
||||
self::accessRemoteUrl(
|
||||
'/?mailpoet-api§ion=queue&action=start&request_payload=' .
|
||||
urlencode($requestPayload)
|
||||
base64_encode($requestPayload)
|
||||
);
|
||||
session_start();
|
||||
if (!isset($_SESSION['cron_daemon'])) {
|
||||
throw new \Exception(__('Session cannot be read.'));
|
||||
}
|
||||
$daemonStatus = $_SESSION['cron_daemon'];
|
||||
unset($_SESSION['daemon']);
|
||||
session_write_close();
|
||||
|
Reference in New Issue
Block a user