Skip to content

Commit

Permalink
CIVICHIMP-6 remove jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
agileware-pengyi committed Dec 13, 2019
1 parent 25798ff commit 1d2dced
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 26 deletions.
14 changes: 14 additions & 0 deletions CRM/Mailchimp/Upgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,20 @@ 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: 0 additions & 26 deletions mailchimp.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,32 +34,6 @@ 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 1d2dced

Please sign in to comment.