function taxonomy_edge_process_queue_item in Taxonomy Edge 8
Same name and namespace in other branches
- 6 taxonomy_edge.module \taxonomy_edge_process_queue_item()
- 7.2 taxonomy_edge.module \taxonomy_edge_process_queue_item()
- 7 taxonomy_edge.module \taxonomy_edge_process_queue_item()
Cron queue worker Process edge for a queued term.
Parameters
integer $vid: Vocabulary ID
1 string reference to 'taxonomy_edge_process_queue_item'
- taxonomy_edge_cron_queue_info in ./
taxonomy_edge.module - Implements hook_cron_queue_info().
File
- ./
taxonomy_edge.module, line 398 - Selecting all children of a given taxonomy term can be a pain. This module makes it easier to do this, by maintaining a complete list of edges for each term using the adjecency matrix graph theory.
Code
function taxonomy_edge_process_queue_item($vid) {
if (lock()
->acquire('taxonomy_edge_rebuild_edges_' . $vid)) {
$queue = DrupalQueue::get('taxonomy_edge_items_' . $vid, TRUE);
$max = 1000;
while ($max-- > 0 && ($item = $queue
->claimItem())) {
$term = $item->data;
switch ($term->operation) {
case 'insert':
_taxonomy_edge_taxonomy_term_insert($term);
break;
case 'update':
_taxonomy_edge_taxonomy_term_update($term);
break;
case 'delete':
_taxonomy_edge_taxonomy_term_delete($term);
break;
}
$queue
->deleteItem($item);
}
lock()
->release('taxonomy_edge_rebuild_edges_' . $vid);
}
}