Revert "Queue"

This commit is contained in:
Marco
2015-11-20 23:51:02 +01:00
parent 32ca24ce38
commit 00f06ea202
10 changed files with 6 additions and 305 deletions

View File

@ -2,7 +2,6 @@
namespace MailPoet\Config;
use MailPoet\Models;
use MailPoet\Queue\Supervisor;
use MailPoet\Router;
if(!defined('ABSPATH')) exit;
@ -26,8 +25,6 @@ class Initializer {
$this->setupAnalytics();
$this->setupPermissions();
$this->setupChangelog();
$this->setupPublicAPI();
$this->runQueueSupervisor();
}
function setupDB() {
@ -36,8 +33,7 @@ class Initializer {
\ORM::configure('password', Env::$db_password);
\ORM::configure('logging', WP_DEBUG);
\ORM::configure('driver_options', array(
\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET TIME_ZONE = "+00:00"'
\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'
));
$subscribers = Env::$db_prefix . 'subscribers';
@ -52,7 +48,6 @@ class Initializer {
$subscriber_custom_field = Env::$db_prefix . 'subscriber_custom_field';
$newsletter_option_fields = Env::$db_prefix . 'newsletter_option_fields';
$newsletter_option = Env::$db_prefix . 'newsletter_option';
$queue = Env::$db_prefix . 'queue';
define('MP_SUBSCRIBERS_TABLE', $subscribers);
define('MP_SETTINGS_TABLE', $settings);
@ -66,7 +61,6 @@ class Initializer {
define('MP_SUBSCRIBER_CUSTOM_FIELD_TABLE', $subscriber_custom_field);
define('MP_NEWSLETTER_OPTION_FIELDS_TABLE', $newsletter_option_fields);
define('MP_NEWSLETTER_OPTION_TABLE', $newsletter_option);
define('MP_QUEUE_TABLE', $queue);
}
function setupActivator() {
@ -116,14 +110,4 @@ class Initializer {
$changelog = new Changelog();
$changelog->init();
}
function setupPublicAPI() {
$publicAPI = new PublicAPI();
$publicAPI->init();
}
function runQueueSupervisor() {
$supervisor = new Supervisor();
$supervisor->checkQueue();
}
}
}

View File

@ -21,7 +21,6 @@ class Migrator {
'subscriber_custom_field',
'newsletter_option_fields',
'newsletter_option',
'queue',
'forms'
);
}
@ -200,21 +199,6 @@ class Migrator {
return $this->sqlify(__FUNCTION__, $attributes);
}
function queue() {
$attributes = array(
'id mediumint(9) NOT NULL AUTO_INCREMENT,',
'newsletter_id mediumint(9) NOT NULL,',
'subscribers longtext,',
'total mediumint(9) NOT NULL DEFAULT 0,',
'processed mediumint(9) NOT NULL DEFAULT 0,',
'created_at TIMESTAMP NOT NULL DEFAULT 0,',
'updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,',
'deleted_at TIMESTAMP NULL DEFAULT NULL,',
'PRIMARY KEY (id)',
);
return $this->sqlify(__FUNCTION__, $attributes);
}
function forms() {
$attributes = array(
'id mediumint(9) NOT NULL AUTO_INCREMENT,',

View File

@ -1,44 +0,0 @@
<?php
namespace MailPoet\Config;
use MailPoet\Queue\Queue;
use Symfony\Component\Config\Definition\Exception\Exception;
if(!defined('ABSPATH')) exit;
class PublicAPI {
function __construct() {
# http://example.com/?mailpoet-api&section=&action=&data=
$this->api = isset($_GET['mailpoet-api']) ? true : false;
$this->section = isset($_GET['section']) ? $_GET['section'] : false;
$this->action = isset($_GET['action']) ? $_GET['action'] : false;
$this->data = isset($_GET['data']) ? $_GET['data'] : false;
}
function init() {
if(!$this->api && !$this->section) return;
if(method_exists($this, $this->section)) {
call_user_func(
array(
$this,
$this->section
));
}
else {
header('HTTP/1.0 404 Not Found');
}
exit;
}
function queue() {
$method = str_replace('_', '', lcfirst(ucwords($this->action, '_')));
$queue = new Queue();
if(method_exists($queue, $method)) {
call_user_func(
array(
$queue,
$method
));
}
}
}