You are here

function sf_notifications_process_confirm_form_submit in Salesforce Suite 7.2

File

sf_notifications/sf_notifications.admin.inc, line 157

Code

function sf_notifications_process_confirm_form_submit($form, &$form_state) {

  // Release any expired claims so they are available to be re-claimed.
  sf_notifications_release_expired_claims();
  $queue = DrupalQueue::get('sf_notifications_queue');
  while ($item = $queue
    ->claimItem(60)) {
    $ret = _sf_notifications_parse_handle_message($item->data);
    if ($ret) {
      salesforce_api_log(SALESFORCE_LOG_ALL, 'Queued notification processed. Contents: <pre>%content</pre>', array(
        '%content' => print_r($item->data, TRUE),
      ));
      $queue
        ->deleteItem($item);
    }
    else {
      salesforce_api_log(SALESFORCE_LOG_ALL, 'Queued notification processing failed. Contents: <pre>%content</pre>', array(
        '%content' => print_r($item->data, TRUE),
      ), WATCHDOG_ERROR);
    }
  }
  drupal_set_message(t('Salesforce notifications queue processed. Check watchdog for any failed processing attempts.'));
  drupal_goto(SALESFORCE_PATH_NOTIFICATIONS_ADMIN . '/queue');
}