- Adds a helper method to convert cameCase to under_score

- Removes unused method from Queue daemon
This commit is contained in:
MrCasual
2015-11-23 15:22:44 -05:00
parent ebd26ddd98
commit 68f747211a
2 changed files with 30 additions and 31 deletions

View File

@@ -78,29 +78,6 @@ class Daemon {
$this->callSelf();
}
function callSelf() {
$payload = json_encode(array('token' => $this->refreshedToken));
$args = array(
'timeout' => 1,
'user-agent' => 'MailPoet (www.mailpoet.com)'
);
wp_remote_get(
Supervisor::getSiteUrl() .
'/?mailpoet-api&section=queue&action=run&payload=' . urlencode($payload),
$args
);
exit;
}
function abortWithError($error) {
wp_send_json(
array(
'result' => false,
'error' => $error
));
exit;
}
function getQueue() {
$queue = Setting::where('name', 'queue')
->findOne();
@@ -109,14 +86,7 @@ class Daemon {
($queue) ? unserialize($queue->value) : null
);
}
function checkAuthorization() {
if(!current_user_can('manage_options')) {
header('HTTP/1.0 401 Not Authorized');
exit;
}
}
function refreshToken() {
return Security::generateRandomString(5);
}
@@ -135,4 +105,27 @@ class Daemon {
break;
}
}
function callSelf() {
$payload = json_encode(array('token' => $this->refreshedToken));
$args = array(
'timeout' => 1,
'user-agent' => 'MailPoet (www.mailpoet.com)'
);
wp_remote_get(
Supervisor::getSiteUrl() .
'/?mailpoet-api&section=queue&action=run&payload=' . urlencode($payload),
$args
);
exit;
}
function abortWithError($error) {
wp_send_json(
array(
'result' => false,
'error' => $error
));
exit;
}
}