function services_client_queue_sync in Services Client 7.2
Same name and namespace in other branches
- 7 services_client.module \services_client_queue_sync()
Sync queued data to other sites. Drupal will use this function as callback in cron run.
Parameters
array $data: Data from queue that contain info about entity that needs to be synced. array( // Version to not process entities from old services_client v1 module. 'version' => 2, // Entity that should be processed. 'entity' => stdClass, // Name of event that should process entity. 'name' => 'event_name', ),
1 call to services_client_queue_sync()
- drush_services_client_process_queue in ./
services_client.drush.inc - Process queued sync jobs
1 string reference to 'services_client_queue_sync'
- services_client_cron_queue_info in ./
services_client.module - Implementation of hook_cron_queue_info().
File
- ./
services_client.module, line 148
Code
function services_client_queue_sync($data) {
if (!empty($data['version']) && $data['version'] == 2) {
$handler = services_client_get_event($data['event']);
if ($handler) {
$handler
->setEntity($data['entity']);
if ($handler
->isMatching()) {
return $handler
->execute();
}
}
}
else {
$legacy_type_map = array(
'node_save' => array(
'node',
'save',
),
'node_delete' => array(
'node',
'delete',
),
'user_save' => array(
'user',
'save',
),
);
$entity = $data['src_data'];
$info = $legacy_type_map[$data['type']];
$result = services_client_process_events($info[1], $entity, $info[0]);
return reset($result);
}
}