Create a new table for stats notification

[MAILPOET-1571]
This commit is contained in:
Pavel Dohnal
2018-12-11 13:23:28 +01:00
parent 423341abb0
commit 9080b5260e
4 changed files with 36 additions and 1 deletions

View File

@@ -86,6 +86,7 @@ class Database {
$statistics_forms = Env::$db_prefix . 'statistics_forms';
$mapping_to_external_entities = Env::$db_prefix . 'mapping_to_external_entities';
$log = Env::$db_prefix . 'log';
$stats_notifications = Env::$db_prefix . 'stats_notifications';
define('MP_SETTINGS_TABLE', $settings);
define('MP_SEGMENTS_TABLE', $segments);
@@ -112,6 +113,7 @@ class Database {
define('MP_STATISTICS_FORMS_TABLE', $statistics_forms);
define('MP_MAPPING_TO_EXTERNAL_ENTITIES_TABLE', $mapping_to_external_entities);
define('MP_LOG_TABLE', $log);
define('MP_STATS_NOTIFICATIONS_TABLE', $stats_notifications);
}
}
}

View File

@@ -18,6 +18,7 @@ class Migrator {
'settings',
'custom_fields',
'scheduled_tasks',
'stats_notifications',
'scheduled_task_subscribers',
'sending_queues',
'subscribers',
@@ -126,6 +127,18 @@ class Migrator {
return $this->sqlify(__FUNCTION__, $attributes);
}
function statsNotifications() {
$attributes = array(
'id int(11) unsigned NOT NULL AUTO_INCREMENT,',
'newsletter_id int(11) unsigned NOT NULL,',
'task_id int(11) unsigned NOT NULL,',
'PRIMARY KEY (id),',
'KEY newsletter_id (newsletter_id),',
'KEY task_id (task_id)',
);
return $this->sqlify(__FUNCTION__, $attributes);
}
function scheduledTaskSubscribers() {
$attributes = array(
'task_id int(11) unsigned NOT NULL,',

View File

@@ -6,7 +6,18 @@ use Carbon\Carbon;
use MailPoet\Models\SendingQueue;
use MailPoet\Models\ScheduledTask;
use MailPoet\Models\Setting;
use MailPoet\Tasks\Sending;
/**
* TODO:
* - finish stats_notifications table, test if it is working and the migration is creating the table
* - remove all the SendingQueue from here
* - in schedule method add a row to stats_notifications table
* - when sending of post notification or a standard newsletter is finished call schedule
* - add processing of this task to Daemon
* - check JIRA what to do next and how to send the newsletter
* - see \MailPoet\Subscribers\NewSubscriberNotificationMailer how to send an email, now with DI everything should be easy
*/
class StatsNotifications {

View File

@@ -0,0 +1,9 @@
<?php
namespace MailPoet\Models;
class StatsNotification extends Model {
public static $_table = MP_STATS_NOTIFICATIONS_TABLE;
}