'#default_value' => BOOST_FLUSH_DIR,
'#description' => t('Disable this if you have to set settings for each dir/subdir, due to the way your server opperates (permissions, etc...).'),
);
+ $form['advanced']['boost_flush_node_terms'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Flush all cached terms pages associted with a node on insert/update/delete'),
+ '#default_value' => BOOST_FLUSH_NODE_TERMS,
+ '#description' => t('Works with view\'s taxonomy/term/% path as well as core.'),
+ );
$form['advanced']['boost_overwrite_file'] = array(
'#type' => 'checkbox',
'#title' => t('Overwrite the cached file if it already exits'),
define('BOOST_OVERWRITE_FILE', variable_get('boost_overwrite_file', FALSE));
define('BOOST_DISABLE_CLEAN_URL', variable_get('boost_disable_clean_url', FALSE));
define('BOOST_VERBOSE', variable_get('boost_verbose', 5));
+define('BOOST_FLUSH_NODE_TERMS', variable_get('boost_flush_node_terms', TRUE));
// This cookie is set for all authenticated users, so that they can be
// excluded from caching (or in the future get a user-specific cached page):
}
boost_cache_expire_derivative('node/' . $node->nid, TRUE);
}
+
+ // get terms and flush their page
+ if (BOOST_FLUSH_NODE_TERMS) {
+ $terms = taxonomy_node_get_terms(node_load($node->nid));
+ $filenames = array();
+ foreach($terms as $term) {
+ $filenames = array_merge($filenames, boost_get_db_term($term->tid));
+ }
+ foreach($filenames as $filename) {
+ boost_cache_kill($filename);
+ }
+ }
break;
}
}
}
/**
+ * Returns all cached pages asscoited with the taxonomy term.
+ */
+function boost_get_db_term($term) {
+ $filenames = array();
+ $result = db_query("SELECT filename FROM {boost_cache} WHERE expire > 0 AND page_id = %d AND page_callback = 'taxonomy'", $term);
+ while ($filename = db_fetch_array($result)) {
+ $filenames[] = $filename['filename'];
+ }
+ return $filenames;
+}
+
+/**
* Writes data to filename in an atomic operation thats compatible with older
* versions of php (php < 5.2.4 file_put_contents() doesn't lock correctly).
*