You are here

function taxonomy_manager_merge_history_update in Taxonomy Manager 6.2

Same name and namespace in other branches
  1. 5 taxonomy_manager.module \taxonomy_manager_merge_history_update()
  2. 6 taxonomy_manager.admin.inc \taxonomy_manager_merge_history_update()

inserts merging information (main_tid - merged_tid ) into taxonomy_manager_merge and updates cache, which is used to reconstructs taxonomy/term pages

Parameters

$main_tid term if of main term:

$merged_tids array of merged term ids:

1 call to taxonomy_manager_merge_history_update()
taxonomy_manager_merge in ./taxonomy_manager.admin.inc
merges terms into another term (main term), all merged term get added to the main term as synonyms. term_node relations are updated automatically (node with one of merging terms gets main term assigned) after all opterions are done (adding of…

File

./taxonomy_manager.admin.inc, line 2224
Taxonomy Manager Admin

Code

function taxonomy_manager_merge_history_update($main_tid, $merged_tids) {
  if (!is_array($merged_tids)) {
    (array) $merged_tids;
  }
  foreach ($merged_tids as $merged_tid) {
    if ($merged_tid != $main_tid) {

      //check if merged term has been a main term once before
      $check_merged = db_result(db_query("SELECT COUNT(*) FROM {taxonomy_manager_merge} WHERE main_tid = %d", $merged_tid));
      if ($check_merged) {
        db_query("UPDATE {taxonomy_manager_merge} SET main_tid = %d WHERE main_tid = %d", $main_tid, $merged_tid);
      }

      //insert into merging history
      db_query("INSERT INTO {taxonomy_manager_merge} (main_tid, merged_tid) VALUES (%d, %d)", $main_tid, $merged_tid);
    }
  }
  taxonomy_manager_merge_history_update_cache();
}