You are here

function taxonomy_edge_modules_enabled in Taxonomy Edge 8

Same name and namespace in other branches
  1. 7 taxonomy_edge.module \taxonomy_edge_modules_enabled()

Implements hook_modules_enabled().

File

./taxonomy_edge.module, line 132
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_modules_enabled($modules) {
  if (in_array('taxonomy_edge', $modules)) {

    // Since we're just enabling the module, it should be safe to truncate.
    // Clearing out the tables will make the rebuild faster, and we're rebuilding
    // everything anyways.
    db_truncate('taxonomy_term_edge')
      ->execute();
    db_truncate('taxonomy_term_edge_order')
      ->execute();

    // Rebuild everything.
    module_load_include('rebuild.inc', 'taxonomy_edge');
    $vids = array_keys(taxonomy_vocabulary_load_multiple());
    if (strpos(request_uri(), '/batch') !== 0) {
      taxonomy_edge_rebuild_all_batch($vids);
    }
  }
}