Commit Graph

221 Commits

Author SHA1 Message Date
e7416c247c Fix error after refactor of SendingErrorHandler
In 862c395d3263f30057aef73a14704345e181dde3, SendingErrorHandler was
refactored to replace the `\MailPoet\Tasks\Sending` class with Doctrine
code. Inside `processSoftError()`, a call to
`$sendingTask->saveSubscriberError()` was replaced with a call to
`$this->scheduledTaskSubscribersRepository->saveError()`. The problem is
that the former updates the processed and unprocessed counts in the
QueueEntity while the later doesn't.

This commit fixes this issue by calling
`$this->sendingQueuesRepository->updateCounts()` inside
`processSoftError()`.

[MAILPOET-5682]
2024-01-12 13:25:46 +01:00
e3ff7ccaca Remove remaining usages of MailPoet\Task\Sending from SendingQueue::processSending()
[MAILPOET-5682]
2024-01-12 13:25:46 +01:00
fa266dadcd Rewrite SendingErrorHandler using Doctrine
[MAILPOET-5682]
2024-01-12 13:25:46 +01:00
7e45fb1c79 Rewrite SendingQueue::sendNewsletter(), sendNewsletters(), and processSendResult() using Doctrine
[MAILPOET-5682]
2024-01-12 13:25:46 +01:00
586ef334b0 Rewrite SendingQueue\Tasks\Newsletter::prepareNewsletterForSending() using Doctrine
[MAILPOET-5682]
2024-01-12 13:25:46 +01:00
44c5ae5664 Pass Doctrine entity into SendingQueue::processQueue(), replace simple usages
[MAILPOET-5682]
2024-01-12 13:25:46 +01:00
ec792b30df Rewrite SendingQueue\Tasks\Newsletter::preProcessNewsletter() using Doctrine
[MAILPOET-5682]
2024-01-12 13:25:46 +01:00
c31cbb73c0 Rewrite SendingQueue\Tasks\Links::process() using Doctrine
[MAILPOET-5682]
2024-01-12 13:25:46 +01:00
16b2817ce6 Rewrite SendingQueue\Tasks\Newsletter::getNewsletterFromQueue() using Doctrine
[MAILPOET-5682]
2024-01-12 13:25:46 +01:00
737c80f953 Rewrite SendingQueue::deleteTaskIfNewsletterDoesNotExist() and deleteTask() using Doctrine
[MAILPOET-5682]
2024-01-12 13:25:46 +01:00
ff9b2a1adb Pass Doctrine entity into SendingQueue::processSending(), replace simple usages
[MAILPOET-5682]
2024-01-12 13:25:46 +01:00
6307f6c155 Rewrite SendingQueue::process() and progress/timeout functions using Doctrine
[MAILPOET-5682]
2024-01-12 13:25:46 +01:00
c76c8f2abb Save the correct datetime value for newsletter sentAt column
We don't need to use the value from `processedAt` here since we can rightfully use the current datetime value

Also, I found out `processedAt` is usually null here for standard newsletters which cause new Carbon to use the server datetime settings

MAILPOET-5795
2023-12-25 21:38:02 +01:00
639d779088 Unify ProcessedAt timezone
Fix a problem in the codebase where we create, schedule and update newsletters in the user time zone, but we set the ProcessedAt with another timezone

Also, `Carbon::createFromTimestamp($this->wp->currentTime('mysql'))` is not a valid date.
It would return date: '1970-01-01 00:35:29.000000'

MAILPOET-5795
2023-12-25 21:38:02 +01:00
525c80bac4 Fix PHPStan warnings in lib
[MAILPOET-5751]
2023-12-13 11:48:14 +01:00
1b31ad11d4 Update UnsubscribeTokens to use DI
MAILPOET-5710
2023-11-13 10:35:54 +01:00
c0ef898dc0 Remove no longer needed Scheduler code
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
2d027d4482 Rewrite Scheduler::processScheduledTransactionalEmail() using Doctrine
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
a8a98478fe Rewrite Scheduler::processScheduledAutomationEmail() using Doctrine
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
bd193968b1 Rewrite Scheduler::processReEngagementEmail() using Doctrine
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
a488d0b275 Rewrite Scheduler::processScheduledAutomaticEmail() using Doctrine
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
d574b55b3f Rewrite Scheduler::processScheduledStandardNewsletter() using Doctrine
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
1ef88a5fb5 Rewrite Scheduler::processPostNotificationNewsletter() using Doctrine
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
6517c697d6 Rewrite Scheduler::processWelcomeNewsletter() using Doctrine
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
a1c0399e96 Implement scheduler task, queue, and subscribers removal with Doctrine
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
e81a7c1517 Enable usage of both Doctrine and legacy task/queue entities in scheduler loop
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
b05bc86223 Remove usages of MailPoet\Tasks\Sending from renderer
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
728e1781c6 Remove usages of MailPoet\Tasks\Sending from stats notification worker
[MAILPOET-4375]
2023-11-02 12:53:36 +01:00
2736348feb Remove remaining use of SendingQueue model in Newsletter class
As far as I could test, calling validate() directly is not necessary.
The call to $sendingTask->save() right above calls validate() internaly
and then any errors will be returned by $sendingTask->getErrors().

I added a integration test that seems to confirm this interpretation.

[MAILPOET-4693]
2023-10-30 10:11:11 +01:00
4d3ee84e38 Improve query by getting only the ID as we don't need the rest
[MAILPOET-5680]
2023-10-30 09:56:38 +01:00
f2214c8cf9 Refactor UnsubscribeTokens to use Doctrine instead of Paris
[MAILPOET-5680]
2023-10-30 09:56:38 +01:00
6e27fe58bc Add next run date logic for mixpanel reporting
MAILPOET-5161
2023-10-23 17:40:54 +02:00
4855aaaa93 Register mixpanel worker
MAILPOET-5161
2023-10-23 17:40:54 +02:00
933fb27265 Create cron worker for reporting mixpanel data
MAILPOET-5161
2023-10-23 17:40:54 +02:00
998a1ef1f0 Add method for sending recovery from an invalid state
[MAILPOET-4891]
2023-09-14 21:03:08 +02:00
7ac2065b1a Track purchases regardless of status but return revenue status correctly
When we apply this commit every purchase will be tracked. When the shop manager updates an order
the status will be updated. For the statistics it will only return values for purchases with
the 'completed' status

[MAILPOET-5485]
2023-09-11 12:14:33 +02:00
317fdee2b6 Use getPurchaseStates helper method for past orders
[MAILPOET-5485]
2023-09-11 12:14:33 +02:00
fe44df1884 Prevent invalid states due to filter segment
MAILPOET-5509
2023-08-31 14:16:10 +02:00
bb7a98ad82 Save filter segment data to queue at send time
MAILPOET-5509
2023-08-31 14:16:10 +02:00
38e709e3b1 Filter subscribers when creating scheduled tasks
MAILPOET-5509
2023-08-31 14:16:10 +02:00
3745b17465 Filter subscribers during sending if filterSegment present
MAILPOET-5509
2023-08-31 14:16:10 +02:00
9b8c4910c1 If newsletter has filterSegmentId, pause if it doesn't exist
MAILPOET-5509
2023-08-31 14:16:10 +02:00
76c299c3d7 Remove global count methods.
In the previous commit, we removed the global count for our output. This commit removes
the logic as the only places where it was used was in recalculating the cache and since
the last commit, we do not use this value anymore

[MAILPOET-4487]
2023-08-18 13:35:13 +02:00
021d8774e7 Wrap bulk updates in a transaction
MAILPOET-5410
2023-08-11 16:39:57 +02:00
f8e0ba118c Nullify engagement score updated at after sends
This will cause the cron job that recalculates engagement score to pick
up these users the next time it runs. This ensures scores don't get
stale.

MAILPOET-5410
2023-08-11 16:39:57 +02:00
0d9a6345d1 Actually use the batch size
MAILPOET-5404
2023-07-12 15:48:03 +02:00
2078ddf292 Save last_subscriber_id as we go
Otherwise the task would always be starting at 0 if it times out

MAILPOET-5404
2023-07-12 15:48:03 +02:00
fc410c2154 Make sure lastProcessedSubscriberId is always correct
MAILPOET-5404
2023-07-12 15:48:03 +02:00
73eae47a39 Add cron worker for backfilling engagement data
MAILPOET-5404
2023-07-12 15:48:03 +02:00
b22217420f Track last sending at
MAILPOET-4998
2023-06-22 15:29:22 +02:00