function salesforce_push_cron in Salesforce Suite 5.0.x
Same name and namespace in other branches
- 8.4 modules/salesforce_push/salesforce_push.module \salesforce_push_cron()
- 8.3 modules/salesforce_push/salesforce_push.module \salesforce_push_cron()
- 7.3 modules/salesforce_push/salesforce_push.module \salesforce_push_cron()
Implements hook_cron().
File
- modules/
salesforce_push/ salesforce_push.module, line 236 - Push updates to Salesforce when a Drupal entity is updated.
Code
function salesforce_push_cron() {
$queue = \Drupal::service('queue.salesforce_push');
if (\Drupal::config('salesforce.settings')
->get('standalone')) {
// If global standalone processing is enabled, stop here.
return;
}
try {
// Process mappings only for those which are not marked standalone.
$mappings = \Drupal::service('entity_type.manager')
->getStorage('salesforce_mapping')
->loadCronPushMappings();
if (empty($mappings)) {
return;
}
$queue
->processQueues($mappings);
} catch (\Exception $e) {
\Drupal::service('event_dispatcher')
->dispatch(new SalesforceErrorEvent($e), SalesforceEvents::ERROR);
}
}