MailPoet Newsletters (New) - Version 3.6.1

Version Description

  • 2018-03-20 =
  • Fixed: prevents sending from being paused for long time during plugin update. Big thanks to Deborah, Kelley, Ciro and Justin!
Download this release

Release Info

Developer wysija
Plugin Icon 128x128 MailPoet Newsletters (New)
Version 3.6.1
Comparing to
See all releases

Code changes from version 3.6.0 to 3.6.1

lang/mailpoet-ca.mo CHANGED
Binary file
lang/mailpoet-da_DK.mo CHANGED
Binary file
lang/mailpoet-de_DE.mo CHANGED
Binary file
lang/mailpoet-es_ES.mo CHANGED
Binary file
lang/mailpoet-fa_IR.mo CHANGED
Binary file
lang/mailpoet-fr_CA.mo CHANGED
Binary file
lang/mailpoet-fr_FR.mo CHANGED
Binary file
lang/mailpoet-it_IT.mo CHANGED
Binary file
lang/mailpoet-ja.mo CHANGED
Binary file
lang/mailpoet-nl_NL.mo CHANGED
Binary file
lang/mailpoet-pl_PL.mo CHANGED
Binary file
lang/mailpoet-pt_BR.mo CHANGED
Binary file
lang/mailpoet-pt_PT.mo CHANGED
Binary file
lang/mailpoet-ru_RU.mo CHANGED
Binary file
lang/mailpoet-sq.mo CHANGED
Binary file
lang/mailpoet-sv_SE.mo CHANGED
Binary file
lang/mailpoet-tr_TR.mo CHANGED
Binary file
lang/mailpoet.pot CHANGED
@@ -4,7 +4,7 @@ msgid ""
4
  msgstr ""
5
  "Project-Id-Version: \n"
6
  "Report-Msgid-Bugs-To: http://support.mailpoet.com/\n"
7
- "POT-Creation-Date: 2018-03-20 14:23:26+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -93,12 +93,12 @@ msgstr ""
93
  msgid "Check your inbox or spam folder to confirm your subscription."
94
  msgstr ""
95
 
96
- #: lib/API/JSON/v1/Forms.php:265 lib/API/JSON/v1/Newsletters.php:240
97
  #: lib/API/JSON/v1/Segments.php:125
98
  msgid "Copy of %s"
99
  msgstr ""
100
 
101
- #: lib/API/JSON/v1/Mailer.php:36 lib/API/JSON/v1/Newsletters.php:344
102
  msgid "The email could not be sent: %s"
103
  msgstr ""
104
 
@@ -107,24 +107,24 @@ msgstr ""
107
  msgid "This template does not exist."
108
  msgstr ""
109
 
110
- #: lib/API/JSON/v1/Newsletters.php:37 lib/API/JSON/v1/Newsletters.php:155
111
- #: lib/API/JSON/v1/Newsletters.php:190 lib/API/JSON/v1/Newsletters.php:206
112
- #: lib/API/JSON/v1/Newsletters.php:222 lib/API/JSON/v1/Newsletters.php:236
113
- #: lib/API/JSON/v1/Newsletters.php:269 lib/API/JSON/v1/Newsletters.php:302
114
  #: lib/API/JSON/v1/SendingQueue.php:35 lib/API/JSON/v1/SendingQueue.php:116
115
  #: lib/API/JSON/v1/SendingQueue.php:142
116
  msgid "This newsletter does not exist."
117
  msgstr ""
118
 
119
- #: lib/API/JSON/v1/Newsletters.php:146
120
  msgid "You need to specify a status."
121
  msgstr ""
122
 
123
- #: lib/API/JSON/v1/Newsletters.php:260
124
  msgid "Newsletter data is missing."
125
  msgstr ""
126
 
127
- #: lib/API/JSON/v1/Newsletters.php:293
128
  msgid "Please specify receiver information."
129
  msgstr ""
130
 
@@ -299,7 +299,7 @@ msgstr ""
299
  msgid "Manage segments"
300
  msgstr ""
301
 
302
- #: lib/Config/Capabilities.php:67 lib/Config/Menu.php:645 views/premium.html:41
303
  msgid "MailPoet"
304
  msgstr ""
305
 
@@ -400,80 +400,80 @@ msgstr[1] ""
400
  msgid "Settings imported"
401
  msgstr ""
402
 
403
- #: lib/Config/Menu.php:86 lib/Config/Menu.php:87 views/newsletters.html:25
404
  msgid "Emails"
405
  msgstr ""
406
 
407
- #: lib/Config/Menu.php:111 lib/Newsletter/Shortcodes/ShortcodesHelper.php:33
408
  #: views/newsletter/templates/components/sidebar/styles.hbs:75
409
  #: views/newsletters.html:126
410
  msgid "Newsletter"
411
  msgstr ""
412
 
413
- #: lib/Config/Menu.php:112 views/newsletter/editor.html:228
414
  msgid "Newsletter Editor"
415
  msgstr ""
416
 
417
- #: lib/Config/Menu.php:124 lib/Config/Menu.php:125 views/forms.html:25
418
  #: views/mp2migration.html:14
419
  msgid "Forms"
420
  msgstr ""
421
 
422
- #: lib/Config/Menu.php:149 lib/Config/Menu.php:150
423
  msgid "Form Editor"
424
  msgstr ""
425
 
426
- #: lib/Config/Menu.php:162 lib/Config/Menu.php:163
427
  #: views/subscribers/subscribers.html:18
428
  msgid "Subscribers"
429
  msgstr ""
430
 
431
- #: lib/Config/Menu.php:187 lib/Config/Menu.php:188
432
  #: views/subscribers/importExport/import.html:7
433
  #: views/subscribers/subscribers.html:95
434
  msgid "Import"
435
  msgstr ""
436
 
437
- #: lib/Config/Menu.php:200 lib/Config/Menu.php:201
438
  #: views/subscribers/importExport/export.html:6
439
  #: views/subscribers/importExport/export.html:82
440
  #: views/subscribers/subscribers.html:96
441
  msgid "Export"
442
  msgstr ""
443
 
444
- #: lib/Config/Menu.php:213 lib/Config/Menu.php:214 views/forms.html:53
445
  #: views/newsletters.html:69 views/newsletters.html:171 views/segments.html:13
446
  #: views/subscribers/subscribers.html:67
447
  msgid "Lists"
448
  msgstr ""
449
 
450
- #: lib/Config/Menu.php:240 lib/Config/Menu.php:241 views/form/editor.html:37
451
  #: views/mp2migration.html:15 views/newsletters.html:70 views/settings.html:6
452
  msgid "Settings"
453
  msgstr ""
454
 
455
- #: lib/Config/Menu.php:253 lib/Config/Menu.php:254 views/help.html:5
456
  msgid "Help"
457
  msgstr ""
458
 
459
- #: lib/Config/Menu.php:267 lib/Config/Menu.php:268
460
  msgid "Premium"
461
  msgstr ""
462
 
463
- #: lib/Config/Menu.php:280 lib/Config/Menu.php:281 views/update.html:12
464
  #: views/welcome.html:12
465
  msgid "Welcome"
466
  msgstr ""
467
 
468
- #: lib/Config/Menu.php:293 lib/Config/Menu.php:294 views/segments.html:43
469
  msgid "Update"
470
  msgstr ""
471
 
472
- #: lib/Config/Menu.php:306
473
  msgid "Migration"
474
  msgstr ""
475
 
476
- #: lib/Config/Menu.php:565
477
  msgid "In any WordPress role"
478
  msgstr ""
479
 
@@ -1097,7 +1097,7 @@ msgstr ""
1097
  msgid "Daemon does not exist."
1098
  msgstr ""
1099
 
1100
- #: lib/Cron/Workers/SendingQueue/Migration.php:56
1101
  msgid ""
1102
  "Your sending queue data is being migrated to allow better performance, "
1103
  "sending is paused while the migration is in progress and will resume "
@@ -5504,22 +5504,22 @@ msgctxt "Error code (inside parentheses)"
5504
  msgid "code: %s"
5505
  msgstr ""
5506
 
5507
- #: lib/Config/Menu.php:99
5508
  msgctxt "newsletters per page (screen options)"
5509
  msgid "Number of newsletters per page"
5510
  msgstr ""
5511
 
5512
- #: lib/Config/Menu.php:137
5513
  msgctxt "forms per page (screen options)"
5514
  msgid "Number of forms per page"
5515
  msgstr ""
5516
 
5517
- #: lib/Config/Menu.php:175
5518
  msgctxt "subscribers per page (screen options)"
5519
  msgid "Number of subscribers per page"
5520
  msgstr ""
5521
 
5522
- #: lib/Config/Menu.php:226
5523
  msgctxt "segments per page (screen options)"
5524
  msgid "Number of segments per page"
5525
  msgstr ""
4
  msgstr ""
5
  "Project-Id-Version: \n"
6
  "Report-Msgid-Bugs-To: http://support.mailpoet.com/\n"
7
+ "POT-Creation-Date: 2018-03-20 21:15:48+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
93
  msgid "Check your inbox or spam folder to confirm your subscription."
94
  msgstr ""
95
 
96
+ #: lib/API/JSON/v1/Forms.php:265 lib/API/JSON/v1/Newsletters.php:241
97
  #: lib/API/JSON/v1/Segments.php:125
98
  msgid "Copy of %s"
99
  msgstr ""
100
 
101
+ #: lib/API/JSON/v1/Mailer.php:36 lib/API/JSON/v1/Newsletters.php:345
102
  msgid "The email could not be sent: %s"
103
  msgstr ""
104
 
107
  msgid "This template does not exist."
108
  msgstr ""
109
 
110
+ #: lib/API/JSON/v1/Newsletters.php:38 lib/API/JSON/v1/Newsletters.php:156
111
+ #: lib/API/JSON/v1/Newsletters.php:191 lib/API/JSON/v1/Newsletters.php:207
112
+ #: lib/API/JSON/v1/Newsletters.php:223 lib/API/JSON/v1/Newsletters.php:237
113
+ #: lib/API/JSON/v1/Newsletters.php:270 lib/API/JSON/v1/Newsletters.php:303
114
  #: lib/API/JSON/v1/SendingQueue.php:35 lib/API/JSON/v1/SendingQueue.php:116
115
  #: lib/API/JSON/v1/SendingQueue.php:142
116
  msgid "This newsletter does not exist."
117
  msgstr ""
118
 
119
+ #: lib/API/JSON/v1/Newsletters.php:147
120
  msgid "You need to specify a status."
121
  msgstr ""
122
 
123
+ #: lib/API/JSON/v1/Newsletters.php:261
124
  msgid "Newsletter data is missing."
125
  msgstr ""
126
 
127
+ #: lib/API/JSON/v1/Newsletters.php:294
128
  msgid "Please specify receiver information."
129
  msgstr ""
130
 
299
  msgid "Manage segments"
300
  msgstr ""
301
 
302
+ #: lib/Config/Capabilities.php:67 lib/Config/Menu.php:646 views/premium.html:41
303
  msgid "MailPoet"
304
  msgstr ""
305
 
400
  msgid "Settings imported"
401
  msgstr ""
402
 
403
+ #: lib/Config/Menu.php:87 lib/Config/Menu.php:88 views/newsletters.html:25
404
  msgid "Emails"
405
  msgstr ""
406
 
407
+ #: lib/Config/Menu.php:112 lib/Newsletter/Shortcodes/ShortcodesHelper.php:33
408
  #: views/newsletter/templates/components/sidebar/styles.hbs:75
409
  #: views/newsletters.html:126
410
  msgid "Newsletter"
411
  msgstr ""
412
 
413
+ #: lib/Config/Menu.php:113 views/newsletter/editor.html:228
414
  msgid "Newsletter Editor"
415
  msgstr ""
416
 
417
+ #: lib/Config/Menu.php:125 lib/Config/Menu.php:126 views/forms.html:25
418
  #: views/mp2migration.html:14
419
  msgid "Forms"
420
  msgstr ""
421
 
422
+ #: lib/Config/Menu.php:150 lib/Config/Menu.php:151
423
  msgid "Form Editor"
424
  msgstr ""
425
 
426
+ #: lib/Config/Menu.php:163 lib/Config/Menu.php:164
427
  #: views/subscribers/subscribers.html:18
428
  msgid "Subscribers"
429
  msgstr ""
430
 
431
+ #: lib/Config/Menu.php:188 lib/Config/Menu.php:189
432
  #: views/subscribers/importExport/import.html:7
433
  #: views/subscribers/subscribers.html:95
434
  msgid "Import"
435
  msgstr ""
436
 
437
+ #: lib/Config/Menu.php:201 lib/Config/Menu.php:202
438
  #: views/subscribers/importExport/export.html:6
439
  #: views/subscribers/importExport/export.html:82
440
  #: views/subscribers/subscribers.html:96
441
  msgid "Export"
442
  msgstr ""
443
 
444
+ #: lib/Config/Menu.php:214 lib/Config/Menu.php:215 views/forms.html:53
445
  #: views/newsletters.html:69 views/newsletters.html:171 views/segments.html:13
446
  #: views/subscribers/subscribers.html:67
447
  msgid "Lists"
448
  msgstr ""
449
 
450
+ #: lib/Config/Menu.php:241 lib/Config/Menu.php:242 views/form/editor.html:37
451
  #: views/mp2migration.html:15 views/newsletters.html:70 views/settings.html:6
452
  msgid "Settings"
453
  msgstr ""
454
 
455
+ #: lib/Config/Menu.php:254 lib/Config/Menu.php:255 views/help.html:5
456
  msgid "Help"
457
  msgstr ""
458
 
459
+ #: lib/Config/Menu.php:268 lib/Config/Menu.php:269
460
  msgid "Premium"
461
  msgstr ""
462
 
463
+ #: lib/Config/Menu.php:281 lib/Config/Menu.php:282 views/update.html:12
464
  #: views/welcome.html:12
465
  msgid "Welcome"
466
  msgstr ""
467
 
468
+ #: lib/Config/Menu.php:294 lib/Config/Menu.php:295 views/segments.html:43
469
  msgid "Update"
470
  msgstr ""
471
 
472
+ #: lib/Config/Menu.php:307
473
  msgid "Migration"
474
  msgstr ""
475
 
476
+ #: lib/Config/Menu.php:566
477
  msgid "In any WordPress role"
478
  msgstr ""
479
 
1097
  msgid "Daemon does not exist."
1098
  msgstr ""
1099
 
1100
+ #: lib/Cron/Workers/SendingQueue/Migration.php:57
1101
  msgid ""
1102
  "Your sending queue data is being migrated to allow better performance, "
1103
  "sending is paused while the migration is in progress and will resume "
5504
  msgid "code: %s"
5505
  msgstr ""
5506
 
5507
+ #: lib/Config/Menu.php:100
5508
  msgctxt "newsletters per page (screen options)"
5509
  msgid "Number of newsletters per page"
5510
  msgstr ""
5511
 
5512
+ #: lib/Config/Menu.php:138
5513
  msgctxt "forms per page (screen options)"
5514
  msgid "Number of forms per page"
5515
  msgstr ""
5516
 
5517
+ #: lib/Config/Menu.php:176
5518
  msgctxt "subscribers per page (screen options)"
5519
  msgid "Number of subscribers per page"
5520
  msgstr ""
5521
 
5522
+ #: lib/Config/Menu.php:227
5523
  msgctxt "segments per page (screen options)"
5524
  msgid "Number of segments per page"
5525
  msgstr ""
lib/API/JSON/v1/Newsletters.php CHANGED
@@ -19,6 +19,7 @@ use MailPoet\Newsletter\Renderer\Renderer;
19
  use MailPoet\Newsletter\Scheduler\Scheduler;
20
  use MailPoet\Newsletter\Url as NewsletterUrl;
21
  use MailPoet\WP\Hooks;
 
22
 
23
  if(!defined('ABSPATH')) exit;
24
 
@@ -169,7 +170,7 @@ class Newsletters extends APIEndpoint {
169
  $queue = $newsletter->queue()->findOne();
170
  if($queue) {
171
  $queue->task()
172
- ->whereLte('scheduled_at', Carbon::createFromTimestamp(current_time('timestamp')))
173
  ->where('status', SendingQueue::STATUS_SCHEDULED)
174
  ->findResultSet()
175
  ->set('scheduled_at', $next_run_date)
@@ -414,7 +415,7 @@ class Newsletters extends APIEndpoint {
414
  'groups' => $listing_data['groups'],
415
  'mta_log' => Setting::getValue('mta_log'),
416
  'mta_method' => Setting::getValue('mta.method'),
417
- 'current_time' => current_time('mysql')
418
  ));
419
  }
420
 
19
  use MailPoet\Newsletter\Scheduler\Scheduler;
20
  use MailPoet\Newsletter\Url as NewsletterUrl;
21
  use MailPoet\WP\Hooks;
22
+ use MailPoet\WP\Functions as WPFunctions;
23
 
24
  if(!defined('ABSPATH')) exit;
25
 
170
  $queue = $newsletter->queue()->findOne();
171
  if($queue) {
172
  $queue->task()
173
+ ->whereLte('scheduled_at', Carbon::createFromTimestamp(WPFunctions::currentTime('timestamp')))
174
  ->where('status', SendingQueue::STATUS_SCHEDULED)
175
  ->findResultSet()
176
  ->set('scheduled_at', $next_run_date)
415
  'groups' => $listing_data['groups'],
416
  'mta_log' => Setting::getValue('mta_log'),
417
  'mta_method' => Setting::getValue('mta.method'),
418
+ 'current_time' => WPFunctions::currentTime('mysql')
419
  ));
420
  }
421
 
lib/Config/Menu.php CHANGED
@@ -25,6 +25,7 @@ use MailPoet\Util\License\License;
25
  use MailPoet\WP\DateTime;
26
  use MailPoet\WP\Notice as WPNotice;
27
  use MailPoet\WP\Readme;
 
28
 
29
  if(!defined('ABSPATH')) exit;
30
 
@@ -383,7 +384,7 @@ class Menu {
383
  $data['is_old_user'] = false;
384
  if(!empty($data['settings']['installed_at'])) {
385
  $installed_at = Carbon::createFromTimestamp(strtotime($data['settings']['installed_at']));
386
- $current_time = Carbon::createFromTimestamp(current_time('timestamp'));
387
  $data['is_new_user'] = $current_time->diffInDays($installed_at) <= 30;
388
  $data['is_old_user'] = $current_time->diffInMonths($installed_at) >= 6;
389
  $data['stop_call_for_rating'] = isset($data['settings']['stop_call_for_rating']) ? $data['settings']['stop_call_for_rating'] : false;
25
  use MailPoet\WP\DateTime;
26
  use MailPoet\WP\Notice as WPNotice;
27
  use MailPoet\WP\Readme;
28
+ use MailPoet\WP\Functions as WPFunctions;
29
 
30
  if(!defined('ABSPATH')) exit;
31
 
384
  $data['is_old_user'] = false;
385
  if(!empty($data['settings']['installed_at'])) {
386
  $installed_at = Carbon::createFromTimestamp(strtotime($data['settings']['installed_at']));
387
+ $current_time = Carbon::createFromTimestamp(WPFunctions::currentTime('timestamp'));
388
  $data['is_new_user'] = $current_time->diffInDays($installed_at) <= 30;
389
  $data['is_old_user'] = $current_time->diffInMonths($installed_at) >= 6;
390
  $data['stop_call_for_rating'] = isset($data['settings']['stop_call_for_rating']) ? $data['settings']['stop_call_for_rating'] : false;
lib/Cron/Workers/Scheduler.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  namespace MailPoet\Cron\Workers;
3
 
4
  use Carbon\Carbon;
@@ -8,8 +9,8 @@ use MailPoet\Models\Subscriber;
8
  use MailPoet\Models\SubscriberSegment;
9
  use MailPoet\Segments\SubscribersFinder;
10
  use MailPoet\Tasks\Sending as SendingTask;
11
- use MailPoet\Util\Helpers;
12
  use MailPoet\Newsletter\Scheduler\Scheduler as NewsletterScheduler;
 
13
 
14
  if(!defined('ABSPATH')) exit;
15
  require_once(ABSPATH . 'wp-includes/pluggable.php');
@@ -125,7 +126,7 @@ class Scheduler {
125
  // check if subscriber is confirmed (subscribed)
126
  if($subscriber->status !== Subscriber::STATUS_SUBSCRIBED) {
127
  // reschedule delivery in 5 minutes
128
- $scheduled_at = Carbon::createFromTimestamp(current_time('timestamp'));
129
  $queue->scheduled_at = $scheduled_at->addMinutes(
130
  self::UNCONFIRMED_SUBSCRIBER_RESCHEDULE_TIMEOUT
131
  );
1
  <?php
2
+
3
  namespace MailPoet\Cron\Workers;
4
 
5
  use Carbon\Carbon;
9
  use MailPoet\Models\SubscriberSegment;
10
  use MailPoet\Segments\SubscribersFinder;
11
  use MailPoet\Tasks\Sending as SendingTask;
 
12
  use MailPoet\Newsletter\Scheduler\Scheduler as NewsletterScheduler;
13
+ use MailPoet\WP\Functions as WPFunctions;
14
 
15
  if(!defined('ABSPATH')) exit;
16
  require_once(ABSPATH . 'wp-includes/pluggable.php');
126
  // check if subscriber is confirmed (subscribed)
127
  if($subscriber->status !== Subscriber::STATUS_SUBSCRIBED) {
128
  // reschedule delivery in 5 minutes
129
+ $scheduled_at = Carbon::createFromTimestamp(WPFunctions::currentTime('timestamp'));
130
  $queue->scheduled_at = $scheduled_at->addMinutes(
131
  self::UNCONFIRMED_SUBSCRIBER_RESCHEDULE_TIMEOUT
132
  );
lib/Cron/Workers/SendingQueue/Migration.php CHANGED
@@ -8,6 +8,7 @@ use MailPoet\Mailer\MailerLog;
8
  use MailPoet\Models\ScheduledTask;
9
  use MailPoet\Models\ScheduledTaskSubscriber;
10
  use MailPoet\Models\SendingQueue;
 
11
 
12
  if(!defined('ABSPATH')) exit;
13
 
@@ -242,6 +243,6 @@ class Migration extends SimpleWorker {
242
 
243
  static function getNextRunDate() {
244
  // run migration immediately
245
- return Carbon::now();
246
  }
247
  }
8
  use MailPoet\Models\ScheduledTask;
9
  use MailPoet\Models\ScheduledTaskSubscriber;
10
  use MailPoet\Models\SendingQueue;
11
+ use MailPoet\WP\Functions as WPFunctions;
12
 
13
  if(!defined('ABSPATH')) exit;
14
 
243
 
244
  static function getNextRunDate() {
245
  // run migration immediately
246
+ return Carbon::createFromTimestamp(WPFunctions::currentTime('timestamp'));
247
  }
248
  }
lib/Cron/Workers/SimpleWorker.php CHANGED
@@ -1,9 +1,11 @@
1
  <?php
 
2
  namespace MailPoet\Cron\Workers;
3
 
4
  use Carbon\Carbon;
5
  use MailPoet\Cron\CronHelper;
6
  use MailPoet\Models\ScheduledTask;
 
7
 
8
  if(!defined('ABSPATH')) exit;
9
 
@@ -94,19 +96,19 @@ abstract class SimpleWorker {
94
  }
95
 
96
  function complete(ScheduledTask $task) {
97
- $task->processed_at = current_time('mysql');
98
  $task->status = ScheduledTask::STATUS_COMPLETED;
99
  $task->save();
100
  }
101
 
102
  function reschedule(ScheduledTask $task, $timeout) {
103
- $scheduled_at = Carbon::createFromTimestamp(current_time('timestamp'));
104
  $task->scheduled_at = $scheduled_at->addMinutes($timeout);
105
  $task->save();
106
  }
107
 
108
  static function getNextRunDate() {
109
- $date = Carbon::createFromTimestamp(current_time('timestamp'));
110
  // Random day of the next week
111
  $date->setISODate($date->format('o'), $date->format('W') + 1, mt_rand(1, 7));
112
  $date->startOfDay();
@@ -116,7 +118,7 @@ abstract class SimpleWorker {
116
  static function getScheduledTasks($future = false) {
117
  $dateWhere = ($future) ? 'whereGt' : 'whereLte';
118
  return ScheduledTask::where('type', static::TASK_TYPE)
119
- ->$dateWhere('scheduled_at', Carbon::createFromTimestamp(current_time('timestamp')))
120
  ->whereNull('deleted_at')
121
  ->where('status', ScheduledTask::STATUS_SCHEDULED)
122
  ->findMany();
@@ -124,7 +126,7 @@ abstract class SimpleWorker {
124
 
125
  static function getRunningTasks() {
126
  return ScheduledTask::where('type', static::TASK_TYPE)
127
- ->whereLte('scheduled_at', Carbon::createFromTimestamp(current_time('timestamp')))
128
  ->whereNull('deleted_at')
129
  ->whereNull('status')
130
  ->findMany();
1
  <?php
2
+
3
  namespace MailPoet\Cron\Workers;
4
 
5
  use Carbon\Carbon;
6
  use MailPoet\Cron\CronHelper;
7
  use MailPoet\Models\ScheduledTask;
8
+ use MailPoet\WP\Functions as WPFunctions;
9
 
10
  if(!defined('ABSPATH')) exit;
11
 
96
  }
97
 
98
  function complete(ScheduledTask $task) {
99
+ $task->processed_at = WPFunctions::currentTime('mysql');
100
  $task->status = ScheduledTask::STATUS_COMPLETED;
101
  $task->save();
102
  }
103
 
104
  function reschedule(ScheduledTask $task, $timeout) {
105
+ $scheduled_at = Carbon::createFromTimestamp(WPFunctions::currentTime('timestamp'));
106
  $task->scheduled_at = $scheduled_at->addMinutes($timeout);
107
  $task->save();
108
  }
109
 
110
  static function getNextRunDate() {
111
+ $date = Carbon::createFromTimestamp(WPFunctions::currentTime('timestamp'));
112
  // Random day of the next week
113
  $date->setISODate($date->format('o'), $date->format('W') + 1, mt_rand(1, 7));
114
  $date->startOfDay();
118
  static function getScheduledTasks($future = false) {
119
  $dateWhere = ($future) ? 'whereGt' : 'whereLte';
120
  return ScheduledTask::where('type', static::TASK_TYPE)
121
+ ->$dateWhere('scheduled_at', Carbon::createFromTimestamp(WPFunctions::currentTime('timestamp')))
122
  ->whereNull('deleted_at')
123
  ->where('status', ScheduledTask::STATUS_SCHEDULED)
124
  ->findMany();
126
 
127
  static function getRunningTasks() {
128
  return ScheduledTask::where('type', static::TASK_TYPE)
129
+ ->whereLte('scheduled_at', Carbon::createFromTimestamp(WPFunctions::currentTime('timestamp')))
130
  ->whereNull('deleted_at')
131
  ->whereNull('status')
132
  ->findMany();
lib/Models/ScheduledTask.php CHANGED
@@ -1,6 +1,9 @@
1
  <?php
 
2
  namespace MailPoet\Models;
3
 
 
 
4
  if(!defined('ABSPATH')) exit;
5
 
6
  class ScheduledTask extends Model {
@@ -34,7 +37,7 @@ class ScheduledTask extends Model {
34
  }
35
 
36
  function complete() {
37
- $this->processed_at = current_time('mysql');
38
  $this->set('status', self::STATUS_COMPLETED);
39
  $this->save();
40
  return ($this->getErrors() === false && $this->id() > 0);
1
  <?php
2
+
3
  namespace MailPoet\Models;
4
 
5
+ use MailPoet\WP\Functions as WPFunctions;
6
+
7
  if(!defined('ABSPATH')) exit;
8
 
9
  class ScheduledTask extends Model {
37
  }
38
 
39
  function complete() {
40
+ $this->processed_at = WPFunctions::currentTime('mysql');
41
  $this->set('status', self::STATUS_COMPLETED);
42
  $this->save();
43
  return ($this->getErrors() === false && $this->id() > 0);
lib/Newsletter/Scheduler/Scheduler.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  namespace MailPoet\Newsletter\Scheduler;
3
 
4
  use Carbon\Carbon;
@@ -8,6 +9,7 @@ use MailPoet\Models\NewsletterOptionField;
8
  use MailPoet\Models\NewsletterPost;
9
  use MailPoet\Models\SendingQueue;
10
  use MailPoet\Tasks\Sending as SendingTask;
 
11
 
12
  class Scheduler {
13
  const SECONDS_IN_HOUR = 3600;
@@ -85,7 +87,7 @@ class Scheduler {
85
  $after_time_type = $newsletter->afterTimeType;
86
  $after_time_number = $newsletter->afterTimeNumber;
87
  $scheduled_at = null;
88
- $current_time = Carbon::createFromTimestamp(current_time('timestamp'));
89
  switch($after_time_type) {
90
  case 'hours':
91
  $scheduled_at = $current_time->addHours($after_time_number);
@@ -162,7 +164,7 @@ class Scheduler {
162
  }
163
 
164
  static function getNextRunDate($schedule, $from_timestamp = false) {
165
- $from_timestamp = ($from_timestamp) ? $from_timestamp : current_time('timestamp');
166
  try {
167
  $schedule = \Cron\CronExpression::factory($schedule);
168
  $next_run_date = $schedule->getNextRunDate(Carbon::createFromTimestamp($from_timestamp))
@@ -174,7 +176,7 @@ class Scheduler {
174
  }
175
 
176
  static function getPreviousRunDate($schedule, $from_timestamp = false) {
177
- $from_timestamp = ($from_timestamp) ? $from_timestamp : current_time('timestamp');
178
  try {
179
  $schedule = \Cron\CronExpression::factory($schedule);
180
  $previous_run_date = $schedule->getPreviousRunDate(Carbon::createFromTimestamp($from_timestamp))
1
  <?php
2
+
3
  namespace MailPoet\Newsletter\Scheduler;
4
 
5
  use Carbon\Carbon;
9
  use MailPoet\Models\NewsletterPost;
10
  use MailPoet\Models\SendingQueue;
11
  use MailPoet\Tasks\Sending as SendingTask;
12
+ use MailPoet\WP\Functions as WPFunctions;
13
 
14
  class Scheduler {
15
  const SECONDS_IN_HOUR = 3600;
87
  $after_time_type = $newsletter->afterTimeType;
88
  $after_time_number = $newsletter->afterTimeNumber;
89
  $scheduled_at = null;
90
+ $current_time = Carbon::createFromTimestamp(WPFunctions::currentTime('timestamp'));
91
  switch($after_time_type) {
92
  case 'hours':
93
  $scheduled_at = $current_time->addHours($after_time_number);
164
  }
165
 
166
  static function getNextRunDate($schedule, $from_timestamp = false) {
167
+ $from_timestamp = ($from_timestamp) ? $from_timestamp : WPFunctions::currentTime('timestamp');
168
  try {
169
  $schedule = \Cron\CronExpression::factory($schedule);
170
  $next_run_date = $schedule->getNextRunDate(Carbon::createFromTimestamp($from_timestamp))
176
  }
177
 
178
  static function getPreviousRunDate($schedule, $from_timestamp = false) {
179
+ $from_timestamp = ($from_timestamp) ? $from_timestamp : WPFunctions::currentTime('timestamp');
180
  try {
181
  $schedule = \Cron\CronExpression::factory($schedule);
182
  $previous_run_date = $schedule->getPreviousRunDate(Carbon::createFromTimestamp($from_timestamp))
lib/Newsletter/Shortcodes/Categories/Date.php CHANGED
@@ -2,6 +2,8 @@
2
 
3
  namespace MailPoet\Newsletter\Shortcodes\Categories;
4
 
 
 
5
  class Date {
6
  static function process(
7
  $action,
@@ -17,10 +19,10 @@ class Date {
17
  'y' => 'Y'
18
  );
19
  if(!empty($action_mapping[$action])) {
20
- return date_i18n($action_mapping[$action], current_time('timestamp'));
21
  }
22
  return ($action === 'custom' && $action_argument === 'format') ?
23
- date_i18n($action_argument_value, current_time('timestamp')) :
24
  false;
25
  }
26
  }
2
 
3
  namespace MailPoet\Newsletter\Shortcodes\Categories;
4
 
5
+ use MailPoet\WP\Functions as WPFunctions;
6
+
7
  class Date {
8
  static function process(
9
  $action,
19
  'y' => 'Y'
20
  );
21
  if(!empty($action_mapping[$action])) {
22
+ return date_i18n($action_mapping[$action], WPFunctions::currentTime('timestamp'));
23
  }
24
  return ($action === 'custom' && $action_argument === 'format') ?
25
+ date_i18n($action_argument_value, WPFunctions::currentTime('timestamp')) :
26
  false;
27
  }
28
  }
lib/Tasks/Sending.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  namespace MailPoet\Tasks;
3
 
4
  use Carbon\Carbon;
@@ -6,6 +7,7 @@ use MailPoet\Models\ScheduledTask;
6
  use MailPoet\Models\ScheduledTaskSubscriber;
7
  use MailPoet\Models\SendingQueue;
8
  use MailPoet\Util\Helpers;
 
9
 
10
  if(!defined('ABSPATH')) exit;
11
 
@@ -221,7 +223,7 @@ class Sending {
221
 
222
  static function getScheduledQueues() {
223
  $tasks = ScheduledTask::where('status', ScheduledTask::STATUS_SCHEDULED)
224
- ->whereLte('scheduled_at', Carbon::createFromTimestamp(current_time('timestamp')))
225
  ->where('type', 'sending')
226
  ->findMany();
227
  $result = array();
1
  <?php
2
+
3
  namespace MailPoet\Tasks;
4
 
5
  use Carbon\Carbon;
7
  use MailPoet\Models\ScheduledTaskSubscriber;
8
  use MailPoet\Models\SendingQueue;
9
  use MailPoet\Util\Helpers;
10
+ use MailPoet\WP\Functions as WPFunctions;
11
 
12
  if(!defined('ABSPATH')) exit;
13
 
223
 
224
  static function getScheduledQueues() {
225
  $tasks = ScheduledTask::where('status', ScheduledTask::STATUS_SCHEDULED)
226
+ ->whereLte('scheduled_at', Carbon::createFromTimestamp(WPFunctions::currentTime('timestamp')))
227
  ->where('type', 'sending')
228
  ->findMany();
229
  $result = array();
lib/WP/DateTime.php CHANGED
@@ -1,6 +1,9 @@
1
  <?php
 
2
  namespace MailPoet\WP;
3
 
 
 
4
  class DateTime {
5
 
6
  const DEFAULT_DATE_FORMAT = 'Y-m-d';
@@ -24,7 +27,7 @@ class DateTime {
24
 
25
  function getCurrentTime($format=false) {
26
  if (empty($format)) $format = $this->getTimeFormat();
27
- return current_time($format);
28
  }
29
 
30
  function getCurrentDate($format=false) {
1
  <?php
2
+
3
  namespace MailPoet\WP;
4
 
5
+ use MailPoet\WP\Functions as WPFunctions;
6
+
7
  class DateTime {
8
 
9
  const DEFAULT_DATE_FORMAT = 'Y-m-d';
27
 
28
  function getCurrentTime($format=false) {
29
  if (empty($format)) $format = $this->getTimeFormat();
30
+ return WPFunctions::currentTime($format);
31
  }
32
 
33
  function getCurrentDate($format=false) {
lib/WP/Functions.php CHANGED
@@ -22,6 +22,10 @@ class Functions {
22
  return self::callWithFallback('wp_remote_retrieve_response_message', func_get_args());
23
  }
24
 
 
 
 
 
25
  private static function callWithFallback($func, $args) {
26
  $local_func = __NAMESPACE__ . '\\' . $func;
27
  if(function_exists($local_func)) {
22
  return self::callWithFallback('wp_remote_retrieve_response_message', func_get_args());
23
  }
24
 
25
+ static function currentTime() {
26
+ return self::callWithFallback('current_time', func_get_args());
27
+ }
28
+
29
  private static function callWithFallback($func, $args) {
30
  $local_func = __NAMESPACE__ . '\\' . $func;
31
  if(function_exists($local_func)) {
mailpoet.php CHANGED
@@ -4,7 +4,7 @@ if(!defined('ABSPATH')) exit;
4
 
5
  /*
6
  * Plugin Name: MailPoet 3 (New)
7
- * Version: 3.6.0
8
  * Plugin URI: http://www.mailpoet.com
9
  * Description: Create and send newsletters, post notifications and welcome emails from your WordPress.
10
  * Author: MailPoet
@@ -20,7 +20,7 @@ if(!defined('ABSPATH')) exit;
20
  */
21
 
22
  $mailpoet_plugin = array(
23
- 'version' => '3.6.0',
24
  'filename' => __FILE__,
25
  'path' => dirname(__FILE__),
26
  'autoloader' => dirname(__FILE__) . '/vendor/autoload.php',
4
 
5
  /*
6
  * Plugin Name: MailPoet 3 (New)
7
+ * Version: 3.6.1
8
  * Plugin URI: http://www.mailpoet.com
9
  * Description: Create and send newsletters, post notifications and welcome emails from your WordPress.
10
  * Author: MailPoet
20
  */
21
 
22
  $mailpoet_plugin = array(
23
+ 'version' => '3.6.1',
24
  'filename' => __FILE__,
25
  'path' => dirname(__FILE__),
26
  'autoloader' => dirname(__FILE__) . '/vendor/autoload.php',
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: newsletter, email, welcome email, post notification, autoresponder, signup
4
  Requires at least: 4.7
5
  Tested up to: 4.9
6
  Requires PHP: 5.3
7
- Stable tag: 3.6.0
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -116,6 +116,9 @@ Stop by our [support site](https://www.mailpoet.com/support).
116
 
117
  == Changelog ==
118
 
 
 
 
119
  = 3.6.0 - 2018-03-20 =
120
  * Improved: previously used widgets settings in the designer are automatically saved to save you time;
121
  * Improved: welcome emails are now sent with our API's subscribeToList method, and not just addSubscriber. Thanks to Sandra and Donald;
4
  Requires at least: 4.7
5
  Tested up to: 4.9
6
  Requires PHP: 5.3
7
+ Stable tag: 3.6.1
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
116
 
117
  == Changelog ==
118
 
119
+ = 3.6.1 - 2018-03-20 =
120
+ * Fixed: prevents sending from being paused for long time during plugin update. Big thanks to Deborah, Kelley, Ciro and Justin!
121
+
122
  = 3.6.0 - 2018-03-20 =
123
  * Improved: previously used widgets settings in the designer are automatically saved to save you time;
124
  * Improved: welcome emails are now sent with our API's subscribeToList method, and not just addSubscriber. Thanks to Sandra and Donald;
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInita0ad1f6434c7957e608711c128817945::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit8984a4428cf64cb5131b0166cb46976b::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInita0ad1f6434c7957e608711c128817945
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInita0ad1f6434c7957e608711c128817945
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInita0ad1f6434c7957e608711c128817945', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInita0ad1f6434c7957e608711c128817945', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
- call_user_func(\Composer\Autoload\ComposerStaticInita0ad1f6434c7957e608711c128817945::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
@@ -48,19 +48,19 @@ class ComposerAutoloaderInita0ad1f6434c7957e608711c128817945
48
  $loader->register(true);
49
 
50
  if ($useStaticLoader) {
51
- $includeFiles = Composer\Autoload\ComposerStaticInita0ad1f6434c7957e608711c128817945::$files;
52
  } else {
53
  $includeFiles = require __DIR__ . '/autoload_files.php';
54
  }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
- composerRequirea0ad1f6434c7957e608711c128817945($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
- function composerRequirea0ad1f6434c7957e608711c128817945($fileIdentifier, $file)
64
  {
65
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
66
  require $file;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit8984a4428cf64cb5131b0166cb46976b
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit8984a4428cf64cb5131b0166cb46976b', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit8984a4428cf64cb5131b0166cb46976b', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
+ call_user_func(\Composer\Autoload\ComposerStaticInit8984a4428cf64cb5131b0166cb46976b::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
48
  $loader->register(true);
49
 
50
  if ($useStaticLoader) {
51
+ $includeFiles = Composer\Autoload\ComposerStaticInit8984a4428cf64cb5131b0166cb46976b::$files;
52
  } else {
53
  $includeFiles = require __DIR__ . '/autoload_files.php';
54
  }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
+ composerRequire8984a4428cf64cb5131b0166cb46976b($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
+ function composerRequire8984a4428cf64cb5131b0166cb46976b($fileIdentifier, $file)
64
  {
65
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
66
  require $file;
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInita0ad1f6434c7957e608711c128817945
8
  {
9
  public static $files = array (
10
  '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
@@ -988,10 +988,10 @@ class ComposerStaticInita0ad1f6434c7957e608711c128817945
988
  public static function getInitializer(ClassLoader $loader)
989
  {
990
  return \Closure::bind(function () use ($loader) {
991
- $loader->prefixLengthsPsr4 = ComposerStaticInita0ad1f6434c7957e608711c128817945::$prefixLengthsPsr4;
992
- $loader->prefixDirsPsr4 = ComposerStaticInita0ad1f6434c7957e608711c128817945::$prefixDirsPsr4;
993
- $loader->prefixesPsr0 = ComposerStaticInita0ad1f6434c7957e608711c128817945::$prefixesPsr0;
994
- $loader->classMap = ComposerStaticInita0ad1f6434c7957e608711c128817945::$classMap;
995
 
996
  }, null, ClassLoader::class);
997
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit8984a4428cf64cb5131b0166cb46976b
8
  {
9
  public static $files = array (
10
  '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
988
  public static function getInitializer(ClassLoader $loader)
989
  {
990
  return \Closure::bind(function () use ($loader) {
991
+ $loader->prefixLengthsPsr4 = ComposerStaticInit8984a4428cf64cb5131b0166cb46976b::$prefixLengthsPsr4;
992
+ $loader->prefixDirsPsr4 = ComposerStaticInit8984a4428cf64cb5131b0166cb46976b::$prefixDirsPsr4;
993
+ $loader->prefixesPsr0 = ComposerStaticInit8984a4428cf64cb5131b0166cb46976b::$prefixesPsr0;
994
+ $loader->classMap = ComposerStaticInit8984a4428cf64cb5131b0166cb46976b::$classMap;
995
 
996
  }, null, ClassLoader::class);
997
  }