From dfbcf7ee8b4be3b5f5ef2b63a8d2e98130a27d97 Mon Sep 17 00:00:00 2001 From: Dmitrii Fediuk Date: Thu, 2 May 2024 21:22:20 +0100 Subject: [PATCH] https://github.com/thehcginstitute-com/m1/issues/590 --- .../community/Ebizmarts/MailChimp/Model/Cron.php | 14 ++++++++++++++ .../Ebizmarts/MailChimp/Model/ProcessWebhook.php | 14 -------------- .../community/Ebizmarts/MailChimp/etc/config.xml | 2 +- app/code/local/HCG/MailChimp/lib/h/main.php | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/app/code/community/Ebizmarts/MailChimp/Model/Cron.php b/app/code/community/Ebizmarts/MailChimp/Model/Cron.php index 909949ecfa..405817b064 100644 --- a/app/code/community/Ebizmarts/MailChimp/Model/Cron.php +++ b/app/code/community/Ebizmarts/MailChimp/Model/Cron.php @@ -13,6 +13,20 @@ function __construct() $this->_mailChimpHelper = hcg_mc_h(); } + /** + * 2024-05-02 Dmitrii Fediuk https://upwork.com/fl/mage2pro + * "Refactor `Ebizmarts_MailChimp_Model_ProcessWebhook`": https://github.com/cabinetsbay/site/issues/590 + * @used-by Aoe_Scheduler_Model_Observer::dispatch() (app/code/community/Ebizmarts/MailChimp/etc/config.xml) + */ + function deleteProcessed():void { + $helper = hcg_mc_h(); + $resource = $helper->getCoreResource(); + $connection = $resource->getConnection('core_write'); + $tableName = $resource->getTableName('mailchimp/webhookrequest'); + $where = ["fired_at < NOW() - INTERVAL 30 DAY AND processed = 1"]; + $connection->delete($tableName, $where); + } + function syncEcommerceBatchData() {\HCG\MailChimp\Batch\Commerce::p();} /** diff --git a/app/code/community/Ebizmarts/MailChimp/Model/ProcessWebhook.php b/app/code/community/Ebizmarts/MailChimp/Model/ProcessWebhook.php index 90736a75fc..e23e64fc90 100644 --- a/app/code/community/Ebizmarts/MailChimp/Model/ProcessWebhook.php +++ b/app/code/community/Ebizmarts/MailChimp/Model/ProcessWebhook.php @@ -3,20 +3,6 @@ # "Refactor `Ebizmarts_MailChimp_Model_ProcessWebhook`": https://github.com/cabinetsbay/site/issues/590 use Ebizmarts_MailChimp_Model_Api_Subscribers_MailchimpTags as Tags; final class Ebizmarts_MailChimp_Model_ProcessWebhook { - /** - * 2024-05-02 Dmitrii Fediuk https://upwork.com/fl/mage2pro - * "Refactor `Ebizmarts_MailChimp_Model_ProcessWebhook`": https://github.com/cabinetsbay/site/issues/590 - * @used-by Aoe_Scheduler_Model_Observer::dispatch() (app/code/community/Ebizmarts/MailChimp/etc/config.xml) - */ - function deleteProcessed():void { - $helper = hcg_mc_h(); - $resource = $helper->getCoreResource(); - $connection = $resource->getConnection('core_write'); - $tableName = $resource->getTableName('mailchimp/webhookrequest'); - $where = array("fired_at < NOW() - INTERVAL 30 DAY AND processed = 1"); - $connection->delete($tableName, $where); - } - /** * 2024-05-02 Dmitrii Fediuk https://upwork.com/fl/mage2pro * "Refactor `Ebizmarts_MailChimp_Model_ProcessWebhook`": https://github.com/cabinetsbay/site/issues/590 diff --git a/app/code/community/Ebizmarts/MailChimp/etc/config.xml b/app/code/community/Ebizmarts/MailChimp/etc/config.xml index 9535507580..276b49b90a 100644 --- a/app/code/community/Ebizmarts/MailChimp/etc/config.xml +++ b/app/code/community/Ebizmarts/MailChimp/etc/config.xml @@ -446,7 +446,7 @@ https://github.com/thehcginstitute-com/m1/issues/573 --> 0 0 * * * - Ebizmarts_MailChimp_Model_ProcessWebhook::deleteProcessed + Ebizmarts_MailChimp_Model_Cron::deleteProcessed ebizmarts_mailchimp diff --git a/app/code/local/HCG/MailChimp/lib/h/main.php b/app/code/local/HCG/MailChimp/lib/h/main.php index 92af317c74..c0f621b2f5 100644 --- a/app/code/local/HCG/MailChimp/lib/h/main.php +++ b/app/code/local/HCG/MailChimp/lib/h/main.php @@ -61,11 +61,11 @@ * @used-by Ebizmarts_MailChimp_Model_ClearBatches::__construct() * @used-by Ebizmarts_MailChimp_Model_ClearEcommerce::__construct() * @used-by Ebizmarts_MailChimp_Model_Cron::__construct() + * @used-by Ebizmarts_MailChimp_Model_Cron::deleteProcessed() * @used-by Ebizmarts_MailChimp_Model_Observer::makeHelper() * @used-by Ebizmarts_MailChimp_Model_ProcessWebhook::_clean() * @used-by Ebizmarts_MailChimp_Model_ProcessWebhook::_unsubscribe() * @used-by Ebizmarts_MailChimp_Model_ProcessWebhook::_updateEmail() - * @used-by Ebizmarts_MailChimp_Model_ProcessWebhook::deleteProcessed() * @used-by Ebizmarts_MailChimp_Model_ProcessWebhook::processWebhookData() * @used-by Ebizmarts_MailChimp_Model_System_Config_Backend_Active::makeHelper() * @used-by Ebizmarts_MailChimp_Model_System_Config_Backend_Apikey::makeHelper()