Skip to content

Commit

Permalink
Merge pull request #340 from cmolava/revert-332-CIVICHIMP-6
Browse files Browse the repository at this point in the history
Revert "Remove unused jobs"
  • Loading branch information
cmolava authored Oct 20, 2020
2 parents 5a33ac6 + 2001f3e commit 4f4a01a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
15 changes: 0 additions & 15 deletions CRM/Mailchimp/Upgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,21 +227,6 @@ public function upgrade_21() {

return TRUE;
}

/**
* Remove unused jobs
*
* @throws \CiviCRM_API3_Exception
*/
public function upgrade_22() {
$result = civicrm_api3('Job', 'get', [
'sequential' => 1,
'name' => ['IN' => ["Mailchimp Push Sync", "Mailchimp Pull Sync"]],
'api.Job.delete' => ['id' => "\$value.id"],
]);

return TRUE;
}
/**
* Example: Run an external SQL script
*
Expand Down
26 changes: 26 additions & 0 deletions mailchimp.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,32 @@ function mailchimp_civicrm_xmlMenu(&$files) {
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_install
*/
function mailchimp_civicrm_install() {

// Create a cron job to do sync data between CiviCRM and MailChimp.
$params = array(
'sequential' => 1,
'name' => 'Mailchimp Push Sync',
'description' => 'Sync contacts between CiviCRM and MailChimp, assuming CiviCRM to be correct. Please understand the implications before using this.',
'run_frequency' => 'Daily',
'api_entity' => 'Mailchimp',
'api_action' => 'pushsync',
'is_active' => 0,
);
$result = civicrm_api3('job', 'create', $params);


// Create Pull Sync job.
$params = array(
'sequential' => 1,
'name' => 'Mailchimp Pull Sync',
'description' => 'Sync contacts between CiviCRM and MailChimp, assuming Mailchimp to be correct. Please understand the implications before using this.',
'run_frequency' => 'Daily',
'api_entity' => 'Mailchimp',
'api_action' => 'pullsync',
'is_active' => 0,
);
$result = civicrm_api3('job', 'create', $params);

return _mailchimp_civix_civicrm_install();
}

Expand Down

0 comments on commit 4f4a01a

Please sign in to comment.