From 7e3448e72335f31cb8fd52a1fedee23b265075bb Mon Sep 17 00:00:00 2001 From: Lorenzo Stramaccia Date: Thu, 14 Feb 2019 17:56:34 +0100 Subject: [PATCH 1/6] Remove Magento/Customer/Setup/RecurringData.php --- .../Magento/Customer/Setup/RecurringData.php | 43 ------------------- 1 file changed, 43 deletions(-) delete mode 100644 app/code/Magento/Customer/Setup/RecurringData.php diff --git a/app/code/Magento/Customer/Setup/RecurringData.php b/app/code/Magento/Customer/Setup/RecurringData.php deleted file mode 100644 index fbef4c05d126d..0000000000000 --- a/app/code/Magento/Customer/Setup/RecurringData.php +++ /dev/null @@ -1,43 +0,0 @@ -indexerRegistry = $indexerRegistry; - } - - /** - * {@inheritdoc} - */ - public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) - { - $indexer = $this->indexerRegistry->get(Customer::CUSTOMER_GRID_INDEXER_ID); - $indexer->reindexAll(); - } -} From 96c6745dd2ec2d8eb57c8bd1b0520c9f53c788a0 Mon Sep 17 00:00:00 2001 From: Lorenzo Stramaccia Date: Wed, 8 May 2019 09:56:10 +0200 Subject: [PATCH 2/6] Added data patch for customer grid reindex --- .../Setup/Patch/Data/ReindexCustomerGrid.php | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 app/code/Magento/Customer/Setup/Patch/Data/ReindexCustomerGrid.php diff --git a/app/code/Magento/Customer/Setup/Patch/Data/ReindexCustomerGrid.php b/app/code/Magento/Customer/Setup/Patch/Data/ReindexCustomerGrid.php new file mode 100644 index 0000000000000..bb74e9892230b --- /dev/null +++ b/app/code/Magento/Customer/Setup/Patch/Data/ReindexCustomerGrid.php @@ -0,0 +1,58 @@ +indexerRegistry = $indexerRegistry; + } + + /** + * {@inheritdoc} + */ + public function apply() + { + $indexer = $this->indexerRegistry->get(Customer::CUSTOMER_GRID_INDEXER_ID); + $indexer->reindexAll(); + } + + /** + * {@inheritdoc} + */ + public static function getDependencies() + { + return []; + } + + /** + * {@inheritdoc} + */ + public function getAliases() + { + return []; + } +} From adfca6cb04b9f5bf20242e0bcf6bfed0989ac070 Mon Sep 17 00:00:00 2001 From: Lorenzo Stramaccia Date: Tue, 14 May 2019 15:55:50 +0200 Subject: [PATCH 3/6] Add reindex commit callback only if indexer is not valid --- app/code/Magento/Customer/Model/Address.php | 2 +- app/code/Magento/Customer/Model/Customer.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Customer/Model/Address.php b/app/code/Magento/Customer/Model/Address.php index e9aa2839095d5..7e162d8d1d2af 100644 --- a/app/code/Magento/Customer/Model/Address.php +++ b/app/code/Magento/Customer/Model/Address.php @@ -326,7 +326,7 @@ public function getEntityTypeId() public function afterSave() { $indexer = $this->indexerRegistry->get(Customer::CUSTOMER_GRID_INDEXER_ID); - if ($indexer->getState()->getStatus() == StateInterface::STATUS_VALID) { + if ($indexer->getState()->getStatus() != StateInterface::STATUS_VALID) { $this->_getResource()->addCommitCallback([$this, 'reindex']); } return parent::afterSave(); diff --git a/app/code/Magento/Customer/Model/Customer.php b/app/code/Magento/Customer/Model/Customer.php index b00f393f53734..71e99eea6b22b 100644 --- a/app/code/Magento/Customer/Model/Customer.php +++ b/app/code/Magento/Customer/Model/Customer.php @@ -1073,7 +1073,7 @@ public function beforeDelete() public function afterSave() { $indexer = $this->indexerRegistry->get(self::CUSTOMER_GRID_INDEXER_ID); - if ($indexer->getState()->getStatus() == StateInterface::STATUS_VALID) { + if ($indexer->getState()->getStatus() != StateInterface::STATUS_VALID) { $this->_getResource()->addCommitCallback([$this, 'reindex']); } return parent::afterSave(); From 9d103b72bda46ecb19c2306a97a40c69a794af24 Mon Sep 17 00:00:00 2001 From: IvanPletnyov Date: Fri, 24 May 2019 15:52:38 +0300 Subject: [PATCH 4/6] pull request 21235: Fix tests. --- .../Customer/Setup/Patch/Data/ReindexCustomerGrid.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Customer/Setup/Patch/Data/ReindexCustomerGrid.php b/app/code/Magento/Customer/Setup/Patch/Data/ReindexCustomerGrid.php index bb74e9892230b..edc72500665af 100644 --- a/app/code/Magento/Customer/Setup/Patch/Data/ReindexCustomerGrid.php +++ b/app/code/Magento/Customer/Setup/Patch/Data/ReindexCustomerGrid.php @@ -11,8 +11,7 @@ use Magento\Framework\Setup\Patch\DataPatchInterface; /** - * Class ReindexCustomerGrid - * @package Magento\Customer\Setup\Patch + * Reindex customer grid during setup process. */ class ReindexCustomerGrid implements DataPatchInterface { @@ -22,7 +21,6 @@ class ReindexCustomerGrid implements DataPatchInterface private $indexerRegistry; /** - * AddCustomerUpdatedAtAttribute constructor. * @param IndexerRegistry $indexerRegistry */ public function __construct( @@ -32,7 +30,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ public function apply() { @@ -41,7 +39,7 @@ public function apply() } /** - * {@inheritdoc} + * @inheritdoc */ public static function getDependencies() { @@ -49,7 +47,7 @@ public static function getDependencies() } /** - * {@inheritdoc} + * @inheritdoc */ public function getAliases() { From 1f14e7de9aaf6f3a412258eca6e04d6d0731c448 Mon Sep 17 00:00:00 2001 From: Lorenzo Stramaccia Date: Tue, 28 May 2019 09:14:14 +0200 Subject: [PATCH 5/6] Revert afterSave to original implementation --- app/code/Magento/Customer/Model/Address.php | 5 +---- app/code/Magento/Customer/Model/Customer.php | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Customer/Model/Address.php b/app/code/Magento/Customer/Model/Address.php index 7e162d8d1d2af..80ae95b4b625f 100644 --- a/app/code/Magento/Customer/Model/Address.php +++ b/app/code/Magento/Customer/Model/Address.php @@ -325,10 +325,7 @@ public function getEntityTypeId() */ public function afterSave() { - $indexer = $this->indexerRegistry->get(Customer::CUSTOMER_GRID_INDEXER_ID); - if ($indexer->getState()->getStatus() != StateInterface::STATUS_VALID) { - $this->_getResource()->addCommitCallback([$this, 'reindex']); - } + $this->_getResource()->addCommitCallback([$this, 'reindex']); return parent::afterSave(); } diff --git a/app/code/Magento/Customer/Model/Customer.php b/app/code/Magento/Customer/Model/Customer.php index 71e99eea6b22b..6b03e0b49e670 100644 --- a/app/code/Magento/Customer/Model/Customer.php +++ b/app/code/Magento/Customer/Model/Customer.php @@ -1072,10 +1072,7 @@ public function beforeDelete() */ public function afterSave() { - $indexer = $this->indexerRegistry->get(self::CUSTOMER_GRID_INDEXER_ID); - if ($indexer->getState()->getStatus() != StateInterface::STATUS_VALID) { - $this->_getResource()->addCommitCallback([$this, 'reindex']); - } + $this->_getResource()->addCommitCallback([$this, 'reindex']); return parent::afterSave(); } From d6a017ab750f2b0af88a1dbfb1ef032be5a4fd3a Mon Sep 17 00:00:00 2001 From: Slava Mankivski Date: Wed, 11 Dec 2019 13:52:30 -0600 Subject: [PATCH 6/6] Update Customer.php --- app/code/Magento/Customer/Model/Customer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/Model/Customer.php b/app/code/Magento/Customer/Model/Customer.php index c73d0dec9424d..51ee4a947c9e1 100644 --- a/app/code/Magento/Customer/Model/Customer.php +++ b/app/code/Magento/Customer/Model/Customer.php @@ -62,7 +62,7 @@ class Customer extends \Magento\Framework\Model\AbstractModel const XML_PATH_RESET_PASSWORD_TEMPLATE = 'customer/password/reset_password_template'; /** - * @deprecated + * @deprecated due to movement of the account confirmation into another class * @see AccountConfirmation::XML_PATH_IS_CONFIRM */ const XML_PATH_IS_CONFIRM = 'customer/create_account/confirm';