function nodequeue_generate_rehash in Nodequeue 6.2
Same name and namespace in other branches
- 5.2 nodequeue_generate.module \nodequeue_generate_rehash()
- 7.3 nodequeue_generate.module \nodequeue_generate_rehash()
- 7.2 nodequeue_generate.module \nodequeue_generate_rehash()
Rebuild all smartqueue_taxonomy queues. Useful after a data migration has wiped your terms. When more smartqueue modules arrive, revisit this function.
Parameters
vids: An array of vocabulary ids.
File
- ./
nodequeue_generate.module, line 150
Code
function nodequeue_generate_rehash($vids) {
// Delete existing smartqueue taxonomy subqueues
db_query("DELETE ns FROM nodequeue_subqueue ns INNER JOIN nodequeue_queue nq ON ns.qid=nq.qid WHERE nq.owner = 'smartqueue_taxonomy'");
// Re-add those subqueues
$node = new stdClass();
$tree = array();
foreach ($vids as $vid) {
$tree += taxonomy_get_tree($vid);
}
$node->taxonomy = $tree;
$queues = nodequeue_load_queues(nodequeue_get_all_qids(200));
foreach ($queues as $queue) {
if ($queue->owner == 'smartqueue_taxonomy') {
nodequeue_api_subqueues($queue, $node);
}
}
}