You are here

function taxonomy_edge_modules_enabled in Taxonomy Edge 7

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

Implements hook_modules_enabled().

File

./taxonomy_edge.module, line 144
Optimization of taxonomy data model for SQL performance.

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_get_vocabularies());
    if (strpos(request_uri(), '/batch') !== 0) {
      taxonomy_edge_rebuild_all_batch($vids);
    }
  }
}