You are here

function lineage_update_all in Taxonomy Lineage 6

Same name and namespace in other branches
  1. 5 lineage.module \lineage_update_all()
  2. 7 lineage.module \lineage_update_all()

Updates all lineage records.

Parameters

$vid=false If passed, limit to records for only one vocabulary.:

Return value

$count The number of records updated.

5 calls to lineage_update_all()
lineage_enable in ./lineage.module
lineage_taxonomy_overview_terms_submit in ./lineage.module
Submit handler for taxonomy_overview_terms (the admin term reordering form). Overrides handling so that we can update lineages after the new term weights are processed. This function is mostly a clone of taxonomy_overview_terms_submit, with the…
lineage_update_2 in ./lineage.install
lineage_update_6000 in ./lineage.install
lineage_update_term in ./lineage.module

File

./lineage.module, line 145

Code

function lineage_update_all($vid = FALSE) {

  // If we are only updating one vocabulary, select only those terms.
  $base_q = "SELECT td.tid, td.name, td.weight, td.vid FROM {term_data} td LEFT JOIN {term_hierarchy} th ON th.tid = td.tid WHERE th.parent = 0";
  if ($vid) {
    $result = db_query($base_q . " AND td.vid = %d", $vid);
  }
  else {
    $result = db_query($base_q);
  }
  $count = 0;
  while ($term = db_fetch_object($result)) {
    $count += lineage_update_term($term, TRUE);
  }
  return $count;
}