You are here

function taxonomy_term_depth_install in Taxonomy Term Depth 7

Same name and namespace in other branches
  1. 8.2 taxonomy_term_depth.install \taxonomy_term_depth_install()
  2. 8 taxonomy_term_depth.install \taxonomy_term_depth_install()

Implements hook_install()

File

./taxonomy_term_depth.install, line 9

Code

function taxonomy_term_depth_install() {
  $table = drupal_get_schema('taxonomy_term_data', TRUE);
  $keys = array(
    'indexes' => array(
      'depth' => array(
        'depth',
        'tid',
      ),
    ),
  );
  db_add_field('taxonomy_term_data', 'depth', $table['fields']['depth'], $keys);

  // Update all term depths
  $options = array();
  batch_set(array(
    'operations' => array(
      array(
        'taxonomy_term_depth_batch_callbacks_update_term_depth',
        array(
          $options,
        ),
      ),
    ),
    'title' => st('Updating depths for all terms'),
    'file' => TAXONOMY_TERM_DEPTH_ROOT_REL . '/taxonomy_term_depth.batch.inc',
  ));
}