Help researchers w. their data
Collated...
Stored.
meaning...
When a Data Manager DID ANYTHING, they had to wait.
http://vignette1.wikia.nocookie.net/r2d/images/5/59/Yo-hurry-up.jpg/revision/latest?cb=20141011053551
/**
* Implements hook_entity_update().
*/
function mymodule_entity_update($entity, $entity_type) {
...
// Remember relevant info.
$item = array(
'entity_type' => $entity_type,
'entity' => $entity,
'op' => 'update',
);
...
}
...
// Create a queue to store items.
// 'TRUE' means get a reliable queue type
// - guarantees every item executes at least once
$queue = DrupalQueue::get('myWorkQueue', TRUE);
// Remember relevant info.
$item = array(
'entity_type' => $entity_type,
'entity' => $entity,
'op' => 'update',
);
// Put an item into the queue.
$queue->createItem($item);
...
Somehow the queue needs to be processed
Our solution was to:
// Get the queue.
// 'TRUE' means get a reliable queue type.
$queue = DrupalQueue::get('myWorkQueue', TRUE);
// Iterate over the items.
while($item = $queue->claimItem()) {
// Get the relevant information.
$entity_type = $item['entity_type'];
$entity = $item['entity'];
$operation = $item['op'];
$success = FALSE;
// Do some work with the information you stored.
// Specify if the task was successful $success = ???.
// If successful, delete the item as it is no longer needed.
if ($success) {
$queue->deleteItem($item);
}
}
// Iterate over the items.
while($item = $queue->claimItem()) {
...
// If successful, delete the item as it is no longer needed.
if ($success) {
$queue->deleteItem($item);
}
}
When an item is not deleted,
it stays in the queue for next time.
http://rbayliss.net/drupal-queue-api
http://www.slideshare.net/philipnorton42/drupal-7-queues
http://atendesigngroup.com/blog/batch-api-cron-queues
https://api.drupal.org/api/examples/queue_example!queue_example.module/
https://api.drupal.org/api/drupal/modules!system!system.queue.inc/group/queue/7
or hit me up: