Merge pull request #1728 from mailpoet/stats-notifications
Stats notifications [ MAILPOET-1571]
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -23,6 +23,7 @@ class Migrator {
|
||||
'settings',
|
||||
'custom_fields',
|
||||
'scheduled_tasks',
|
||||
'stats_notifications',
|
||||
'scheduled_task_subscribers',
|
||||
'sending_queues',
|
||||
'subscribers',
|
||||
@@ -131,12 +132,26 @@ class Migrator {
|
||||
return $this->sqlify(__FUNCTION__, $attributes);
|
||||
}
|
||||
|
||||
function scheduledTaskSubscribers() {
|
||||
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,',
|
||||
'created_at TIMESTAMP NULL,',
|
||||
'updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,',
|
||||
'PRIMARY KEY (id),',
|
||||
'UNIQUE KEY newsletter_id_task_id (newsletter_id, task_id),',
|
||||
'KEY task_id (task_id)',
|
||||
);
|
||||
return $this->sqlify(__FUNCTION__, $attributes);
|
||||
}
|
||||
|
||||
function scheduledTaskSubscribers() {
|
||||
$attributes = array (
|
||||
'task_id int(11) unsigned NOT NULL,',
|
||||
'subscriber_id int(11) unsigned NOT NULL,',
|
||||
'processed int(1) NOT NULL,',
|
||||
'failed int(1) NOT NULL DEFAULT 0,',
|
||||
'failed SMALLINT(1) NOT NULL DEFAULT 0,',
|
||||
'error text NULL,',
|
||||
'created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,',
|
||||
'PRIMARY KEY (task_id, subscriber_id),',
|
||||
|
@@ -194,6 +194,15 @@ class Populator {
|
||||
]);
|
||||
}
|
||||
|
||||
$stats_notifications = Setting::getValue('stats_notifications');
|
||||
if(empty($stats_notifications)) {
|
||||
$sender = Setting::getValue('sender', []);
|
||||
Setting::setValue('stats_notifications', [
|
||||
'enabled' => true,
|
||||
'address' => isset($sender['address'])? $sender['address'] : null,
|
||||
]);
|
||||
}
|
||||
|
||||
// reset mailer log
|
||||
MailerLog::resetMailerLog();
|
||||
}
|
||||
|
Reference in New Issue
Block a user