Skip to content

Commit

Permalink
https://github.com/thehcginstitute-com/m1/issues/590
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrii-fediuk committed May 2, 2024
1 parent a85c7c8 commit dfbcf7e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
14 changes: 14 additions & 0 deletions app/code/community/Ebizmarts/MailChimp/Model/Cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();}

/**
Expand Down
14 changes: 0 additions & 14 deletions app/code/community/Ebizmarts/MailChimp/Model/ProcessWebhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/code/community/Ebizmarts/MailChimp/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ https://github.com/thehcginstitute-com/m1/issues/573 -->
<cron_expr>0 0 * * *</cron_expr>
</schedule>
<run>
<model>Ebizmarts_MailChimp_Model_ProcessWebhook::deleteProcessed</model>
<model>Ebizmarts_MailChimp_Model_Cron::deleteProcessed</model>
</run>
<groups>ebizmarts_mailchimp</groups>
</mailchimp_delete_webhook_processed>
Expand Down
2 changes: 1 addition & 1 deletion app/code/local/HCG/MailChimp/lib/h/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit dfbcf7e

Please sign in to comment.