function acquia_lift_batch_sync_campaigns in Acquia Lift Connector 7
Batch syncs all campaigns to Lift.
2 calls to acquia_lift_batch_sync_campaigns()
- acquia_lift_batch_sync_form_submit in ./
acquia_lift.admin.inc - Submit callback for the batch sync form.
- acquia_lift_sync_campaign_submit in ./
acquia_lift.module - Submit callback for the "Sync with Lift" button.
File
- ./
acquia_lift.batch.inc, line 12 - acquia_lift.batch.inc
Code
function acquia_lift_batch_sync_campaigns($agents = array()) {
// First delete the queue because we are about to sync everything now.
acquia_lift_delete_queue();
// Now get all sync operations for all existing Acquia Lift agents.
if (empty($agents)) {
foreach (acquia_lift_get_agent_types() as $type => $info) {
$agents = array_merge($agents, personalize_agent_load_by_type($type));
}
}
$operations = acquia_lift_get_sync_operations_for_agents($agents);
$batch_operations = array();
foreach ($operations as $operation) {
$batch_operations[] = array(
'acquia_lift_batch_process_item',
array(
$operation,
),
);
}
$batch = array(
'operations' => $batch_operations,
'finished' => 'acquia_lift_batch_finished',
'title' => t('Syncing campaign components to Acquia Lift'),
'init_message' => t('Starting campaign sync.'),
'progress_message' => t('Processed @current out of @total.'),
'error_message' => t('Lift campaign sync has encountered an error.'),
'file' => drupal_get_path('module', 'acquia_lift') . '/acquia_lift.batch.inc',
);
batch_set($batch);
}