summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--boost.module22
1 files changed, 19 insertions, 3 deletions
diff --git a/boost.module b/boost.module
index 8e619a9..ed2a576 100644
--- a/boost.module
+++ b/boost.module
@@ -347,10 +347,10 @@ function boost_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
// get terms and flush their page
if (BOOST_FLUSH_NODE_TERMS) {
- $terms = taxonomy_node_get_terms(node_load($node->nid));
+ $tids = boost_taxonomy_node_get_tids($node->nid);
$filenames = array();
- foreach($terms as $term) {
- $filenames = array_merge($filenames, boost_get_db_term($term->tid));
+ foreach($tids as $tid) {
+ $filenames = array_merge($filenames, boost_get_db_term($tid));
}
foreach($filenames as $filename) {
boost_cache_kill($filename);
@@ -361,6 +361,22 @@ function boost_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
}
/**
+ * Return taxonomy terms given a nid.
+ *
+ * Needed because of a weird bug with CCK & node_load()
+ * http://drupal.org/node/545922
+ */
+function boost_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;
+}
+
+/**
* Implementation of hook_taxonomy(). Acts on taxonomy changes.
*/
function boost_taxonomy($op, $type, $term = NULL) {