Commit Graph

37 Commits

Author SHA1 Message Date
Rostislav Wolny
33f4b2d729 Replace usage of WP's current_time without gmt parameter in libs
This commit replaces usages by Carbon::now or in case we need a timestamp it
keeps current_time but adds the gtm parameter as true.
[MAILPOET-6142]
2024-08-19 15:29:42 +02:00
Jan Jakes
ff6a98fae1 Replace deprecated array types with Doctrine's ArrayParameterType
[MAILPOET-6142]
2024-08-19 15:29:42 +02:00
Jan Lysý
e998e1f28f Add a comment why we need to remove the colon character
[MAILPOET-6101]
2024-06-17 12:38:08 +02:00
Jan Lysý
26a98f1000 Update composer package doctrine/dbal
We cannot update to the latest version of the dbal 3 because there is a another package conflict.
[MAILPOET-6101]
2024-06-17 12:38:08 +02:00
 Ján Mikláš
057f25c119 Don't allow importing to WordPress Users list
[MAILPOET-3977]
2024-06-12 12:13:37 +02:00
Mike Jolley
435f638011 Apply rules on lib dir 2024-03-21 16:57:59 +01:00
Jan Jakes
51a14a45d3 Use refreshAll() for updates, refresh subscribers/subscriber custom fields conditionally
[MAILPOET-5752]
2024-02-12 15:33:28 +01:00
alex-mpoet
014b8249bb Replace entityManager->clear with a helper, add cleanup to WP user sync
[MAILPOET-5752]
2024-02-12 15:33:28 +01:00
Rodrigo Primo
f0434d74e7 Ensure Doctrine entity cache is cleared after changing the database
ImportExportRepository::updateMultiple() changes subscribers by running
MySQL queries directly. Now that \MailPoet\Segments\WP uses Doctrine as
well this was causing a bug caught by our integration tests.

```
MailPoet\Subscribers\ImportExport\Import\ImportTest::testItSynchronizesWpUsers
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'mary'
+'Mary'

/wp-core/wp-content/plugins/mailpoet/tests/integration/Subscribers/ImportExport/Import/ImportTest.php:719
```

https://app.circleci.com/pipelines/github/mailpoet/mailpoet/16386/workflows/c3fa0cf4-a77d-41ab-a5cc-78d4b37d9228/jobs/278066/tests#failed-test-0

This test was failing because the Doctrine entities were not updated
after the import process ran and modified the subscribers directly in
the database. Running EntityManager::clear() after importing the
subscribers, forces Doctrine to query the database again to update the
entities and prevents this bug.

[MAILPOET-5752]
2024-02-12 15:33:28 +01:00
alex-mpoet
5824905f18 Independently update existing subscribers info and status in import
[MAILPOET-5617]
2024-02-05 12:54:02 +01:00
Jan Lysý
525c80bac4 Fix PHPStan warnings in lib
[MAILPOET-5751]
2023-12-13 11:48:14 +01:00
Jan Jakes
e2cf884b98 Add missing ContainerWrapper return type, fix reported errors
[MAILPOET-5569]
2023-09-20 02:36:40 -07:00
Pavel Dohnal
798bc320ed Make sure the doctrine parameters are unique
Previously there was a mismatch between parameters coming from the
dynamic segment and the parameters coming from the export
controller.

[MAILPOET-5382]
2023-06-16 17:00:33 +02:00
Rodrigo Primo
00d021109c Move ModelValidator::validateNonRoleEmail() to a new Validator class
We want to remove/refactor the whole ModelValidator class as part of the
Doctrine refactor.

This commit moves the method ModelValidator::validateNonRoleEmail() to a
new Validator class as the method is not used by the validator system of
the Paris models. ModelValidator::validateEmail() was also moved as it
is called by ModelValidator::validateNonRoleEmail().

[MAILPOET-4343]
2023-05-17 12:37:22 +02:00
Rodrigo Primo
d760272678 Remove ModelValidator::validateIPAddress()
We want to remove/refactor the whole ModelValidator class as part of the
Doctrine refactor. As a first step, this commit removes the method
ModelValidator::validateIPAddress(). It was unused in a single place and
it was replaced with a direct call to the builtin PHP way to validate an
IP address.

[MAILPOET-4343]
2023-05-17 12:37:22 +02:00
John Oleksowicz
f9d6e65ece Ensure personal data exporter includes all custom fields
The test testExportSubscriberWithCustomField was only passing before
because we were truncating tables in between tests, so the custom field
id ended up matching the subscriber custom field id coincidentally.

MAILPOET-5145
MAILPOET-5185
2023-04-07 12:11:12 -05:00
Sam Najian
1a7b7d1936 Escape segment name for usage in html select
[MAILPOET-4942]
2023-01-16 13:59:30 +01:00
Jan Jakes
926620e8f8 Ignore strict types rule in all existing files that don't have it
[MAILPOET-2688]
2022-11-29 15:04:09 +01:00
Jan Lysý
0bbf1b96d5 Add notifications about imported subscribers
[MAILPOET-4727]
2022-10-27 09:31:40 +02:00
Jan Lysý
daa5575d87 Reduce maximum records count in batch to exact size
[MAILPOET-4558]
2022-09-15 11:26:10 +02:00
Jan Lysý
5c57dd2006 Add saving tags for imported subscribers
[MAILPOET-4558]
2022-09-15 11:26:10 +02:00
Jan Lysý
a523bb493f Add a token field with tags to the import form
[MAILPOET-4558]
2022-09-15 11:26:10 +02:00
Pavel Dohnal
086852ee4d Remove version number from the source
[MAILPOET-4474]
2022-09-09 11:25:51 +02:00
Jan Jakes
24cca1ba04 Cache total subscribers count, add tests
[MAILPOET-4416]
2022-08-24 12:18:44 +02:00
David Remer
b05e6d414c Remove WP\Functions::__ and other translate functions
Under the new sniffer rules, those functions produce errors and, when those methods
are used, the sniffer can not properly be applied.

[MAILPOET-4524]
2022-08-09 13:23:16 +02:00
Sam Najian
5b0e7128c6 Remove usages of StatisticsNewsletters in newsletter exporter
[MAILPOET-4348]
2022-08-01 14:18:59 +02:00
Sam Najian
31aa18868b Remove traces of older models in PersonalDataExports namespace
[MAILPOET-4348]
2022-08-01 14:18:59 +02:00
Sam Najian
10d4eb5d7f Remove old models from SegmentsExporter
[MAILPOET-4348]
2022-08-01 14:18:59 +02:00
Sam Najian
a2f65bf647 Migrate PersonalDataExporters\NewslettersExporter to Doctrine
[MAILPOET-4348]
2022-07-18 16:47:48 +02:00
Brezo Cordero
7c6f0b7777 Specify type of $fieldName to string on addField
[MAILPOET-3720]
2022-05-25 09:43:47 +02:00
Brezo Cordero
94fe87008a Remove PHPStan level 6 errors from Import
Remove the following errors from Subscribers\ImportExport\Import\MailChimp:
(Method|Property|Function) has no (return )?type specified.
(Method|Function) has parameter with no type (specified).

[MAILPOET-3720]
2022-05-25 09:43:47 +02:00
Brezo Cordero
34ce6cd329 Remove PHPStan level 6 errors from Import
Remove the following errors from Subscribers\ImportExport\Import\Import:
(Method|Property|Function) has no (return )?type specified.
(Method|Function) has parameter with no type (specified).

I have also added a few checks when using count and typed the arrays when possible.

[MAILPOET-3720]
2022-05-25 09:43:47 +02:00
Brezo Cordero
f6dfb19362 Remove PHPStan level 6 errors from Segments\WP
Remove the following errors:
(Method|Property|Function) has no (return )?type specified.
(Method|Function) has parameter with no type (specified).
array_walk on import.php was expecting the key as the second parameter to the function. I have switched it to array_map.

[MAILPOET-3720]
2022-05-23 12:04:12 +02:00
Rodrigo Primo
5c9926b140 Refactor ImportExportFactory to use Doctrine instead of Paris
[MAILPOET-4139]
2022-05-23 11:37:26 +02:00
Rostislav Wolny
ac0a9e7b6f Update doctrine/* libraries
[MAILPOET-4175]
2022-03-28 13:49:41 +02:00
Brezo Cordero
9f822818c3 Make sure batch size is positive integer
Fixes PHPStan error array_chunk expects int<1, max>.

[MAILPOET-4131]
2022-03-07 16:07:16 +01:00
Jan Jakes
9f790efbf0 Move plugin files to a subfolder
[MAILPOET-3988]
2022-01-18 15:30:22 +01:00