Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused jobs #332

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CRM/Mailchimp/Upgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,21 @@ 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