You are here

function expire_taxonomy_node_get_tids in Cache Expiration 6

Return taxonomy terms given a nid.

Needed because of a weird bug with CCK & node_load() http://drupal.org/node/545922

1 call to expire_taxonomy_node_get_tids()
expire_node in ./expire.module
Expires a node from the cache; including related pages.

File

./expire.module, line 386
Provides logic for page cache expiration

Code

function expire_taxonomy_node_get_tids($nid) {
  $vid = db_result(db_query("SELECT vid FROM {node} WHERE nid = %d", $nid));
  $result = db_query(db_rewrite_sql("SELECT t.tid FROM {term_node} r INNER JOIN {term_data} t ON r.tid = t.tid INNER JOIN {vocabulary} v ON t.vid = v.vid WHERE r.vid = %d ORDER BY v.weight, t.weight, t.name", 't', 'tid'), $vid);
  $tids = array();
  while ($term = db_result($result)) {
    $tids[] = $term;
  }
  return $tids;
}