- Rebases master
This commit is contained in:
@@ -13,17 +13,16 @@ class Posts {
|
||||
preg_match_all(
|
||||
'/data-post-id="(\d+)"/ism',
|
||||
$newsletter['rendered_body']['html'],
|
||||
$matached_posts);
|
||||
$matached_posts = $matached_posts[1];
|
||||
if(!count($matached_posts)) {
|
||||
$matched_posts_ids);
|
||||
$matched_posts_ids = $matched_posts_ids[1];
|
||||
if(!count($matched_posts_ids)) {
|
||||
return $newsletter;
|
||||
}
|
||||
foreach($matached_posts as $post) {
|
||||
foreach($matched_posts_ids as $post_id) {
|
||||
$newletter_post = NewsletterPost::create();
|
||||
$newletter_post->newsletter_id = $newsletter['id'];
|
||||
$newletter_post->post_id = $post;
|
||||
$newletter_post->post_id = $post_id;
|
||||
$newletter_post->save();
|
||||
}
|
||||
return $newsletter;
|
||||
}
|
||||
}
|
@@ -7,7 +7,7 @@ use MailPoet\Util\Helpers;
|
||||
if(!defined('ABSPATH')) exit;
|
||||
|
||||
class Statistics {
|
||||
static function updateBulkNewsletterStatistics(
|
||||
static function processAndLogBulkNewsletterStatistics(
|
||||
array $processed_subscribers_ids, $newsletter_id, $queue_id
|
||||
) {
|
||||
$newsletter_statistics = array();
|
||||
@@ -19,12 +19,10 @@ class Statistics {
|
||||
);
|
||||
}
|
||||
$newsletter_statistics = Helpers::flattenArray($newsletter_statistics);
|
||||
return self::logStatistics($newsletter_statistics);
|
||||
}
|
||||
|
||||
static function logStatistics($newsletter_statistics) {
|
||||
return StatisticsNewsletters::createMultiple($newsletter_statistics);
|
||||
}
|
||||
|
||||
static function updateBulkNewsletterStatistics(
|
||||
array $processed_subscribers_ids, $newsletter_id, $queue_id
|
||||
) {
|
||||
|
||||
}
|
||||
}
|
@@ -16,26 +16,48 @@ class Subscribers {
|
||||
}
|
||||
|
||||
static function updateToProcessList(
|
||||
array $existing_subscribers_ids,
|
||||
array $found_subscribers_ids,
|
||||
array $subscribers_to_process_ids,
|
||||
array $queue_subscribers_to_process_ids
|
||||
array $queue_subscribers
|
||||
) {
|
||||
// compare existing subscriber to the ones that queued for processing
|
||||
$subscibers_to_exclude = array_diff(
|
||||
$subscribers_to_process_ids,
|
||||
$existing_subscribers_ids
|
||||
$found_subscribers_ids
|
||||
);
|
||||
// remove nonexistent subscribers from the processing list
|
||||
return array_diff(
|
||||
$queue_subscribers_to_process_ids,
|
||||
$subscibers_to_exclude
|
||||
$queue_subscribers['to_process'] = array_diff(
|
||||
$subscibers_to_exclude,
|
||||
$queue_subscribers['to_process']
|
||||
);
|
||||
return $queue_subscribers;
|
||||
}
|
||||
|
||||
static function updateFailedList(array $subscribers, array $failed_subscribers) {
|
||||
return array_merge(
|
||||
$subscribers,
|
||||
static function updateFailedList(
|
||||
array $failed_subscribers, array $queue_subscribers
|
||||
) {
|
||||
$queue_subscribers['failed'] = array_merge(
|
||||
$queue_subscribers['failed'],
|
||||
$failed_subscribers
|
||||
);
|
||||
$queue_subscribers['to_process'] = array_diff(
|
||||
$failed_subscribers,
|
||||
$queue_subscribers['to_process']
|
||||
);
|
||||
return $queue_subscribers;
|
||||
}
|
||||
|
||||
static function updateProcessedList(
|
||||
array $processed_subscribers, array $queue_subscribers
|
||||
) {
|
||||
$queue_subscribers['processed'] = array_merge(
|
||||
$queue_subscribers['processed'],
|
||||
$processed_subscribers
|
||||
);
|
||||
$queue_subscribers['to_process'] = array_diff(
|
||||
$processed_subscribers,
|
||||
$queue_subscribers['to_process']
|
||||
);
|
||||
return $queue_subscribers;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user