You are here

function taxonomy_edge_is_build_realtime in Taxonomy Edge 7.2

Same name and namespace in other branches
  1. 8 taxonomy_edge.module \taxonomy_edge_is_build_realtime()
  2. 6 taxonomy_edge.module \taxonomy_edge_is_build_realtime()
  3. 7 taxonomy_edge.module \taxonomy_edge_is_build_realtime()

Checks if it's possible to build an edge realtime.

Return value

boolean TRUE if possible, FALSE if not.

3 calls to taxonomy_edge_is_build_realtime()
taxonomy_edge_taxonomy_term_delete in ./taxonomy_edge.module
Implements hook_taxonomy_term_delete().
taxonomy_edge_taxonomy_term_insert in ./taxonomy_edge.module
Implements hook_taxonomy_term_insert().
taxonomy_edge_taxonomy_term_update in ./taxonomy_edge.module
Implements hook_taxonomy_term_update().

File

./taxonomy_edge.module, line 789
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_is_build_realtime($vid) {
  if (variable_get('taxonomy_edge_build_realtime', TAXONOMY_EDGE_BUILD_REALTIME)) {
    $queue = DrupalQueue::get('taxonomy_edge_items_' . $vid, TRUE);
    if ($queue
      ->numberOfItems()) {

      // Don't build realtime, if there are still items left in the queue.
      return FALSE;
    }
    if (!lock_may_be_available('taxonomy_edge_rebuild_edges_' . $vid)) {

      // Don't build realtime, if entire tree rebuild is in progress.
      return FALSE;
    }
    return TRUE;
  }
  return FALSE;
}