? boost-453908.patch
Index: boost.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/boost/boost.admin.inc,v
retrieving revision 1.1.2.1.2.3.2.84
diff -u -p -r1.1.2.1.2.3.2.84 boost.admin.inc
--- boost.admin.inc	10 Oct 2009 06:34:07 -0000	1.1.2.1.2.3.2.84
+++ boost.admin.inc	10 Oct 2009 07:56:16 -0000
@@ -412,12 +412,12 @@ function boost_admin_boost_performance_p
     '#default_value' => BOOST_FLUSH_VIEWS,
     '#description'   => t(''),
   );
-//   $form['advanced']['boost_flush_views_insert'] = array(
-//     '#type'          => 'checkbox',
-//     '#title'         => t('Clear all cached views pages associated with a node on insert'),
-//     '#default_value' => BOOST_FLUSH_VIEWS_INSERT,
-//     '#description'   => t(''),
-//   );
+  $form['advanced']['boost_flush_views_insert'] = array(
+    '#type'          => 'checkbox',
+    '#title'         => t('Clear all cached views pages associated with a node on insert'),
+    '#default_value' => BOOST_FLUSH_VIEWS_INSERT,
+    '#description'   => t('WARNING: This can be very slow, all views get run to find out where this node lives.'),
+  );
   $form['advanced']['boost_clear_cache_offline'] = array(
     '#type'          => 'checkbox',
     '#title'         => t('Clear Boosts cache when site goes offline'),
Index: boost.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/boost/boost.module,v
retrieving revision 1.3.2.2.2.5.2.176
diff -u -p -r1.3.2.2.2.5.2.176 boost.module
--- boost.module	10 Oct 2009 06:34:07 -0000	1.3.2.2.2.5.2.176
+++ boost.module	10 Oct 2009 07:56:17 -0000
@@ -70,6 +70,7 @@ define('BOOST_VERBOSE',              var
 define('BOOST_FLUSH_NODE_TERMS',     variable_get('boost_flush_node_terms', TRUE));
 define('BOOST_FLUSH_CCK_REFERENCES', variable_get('boost_flush_cck_references', TRUE));
 define('BOOST_FLUSH_VIEWS',          variable_get('boost_flush_views', FALSE));
+define('BOOST_FLUSH_VIEWS_INSERT',   variable_get('boost_flush_views_insert', FALSE));
 define('BOOST_EXPIRE_NO_FLUSH',      variable_get('boost_expire_no_flush', FALSE));
 define('BOOST_MAX_TIMESTAMP',        variable_get('boost_max_timestamp', BOOST_TIME));
 
@@ -114,6 +115,7 @@ define('BOOST_MAX_THREAD_TIME',      max
 //$GLOBALS['_boost_default_socket_timeout'] = '';
 //$GLOBALS['_boost_router_item'] = '';
 //$GLOBALS['_boost_relationships'] = '';
+//$GLOBALS['_boost_nid'] = '';
 
 //////////////////////////////////////////////////////////////////////////////
 // Core API hooks
@@ -422,6 +424,10 @@ function boost_nodeapi(&$node, $op, $tea
 
   switch ($op) {
     case 'insert':
+      if (BOOST_FLUSH_VIEWS_INSERT) {
+        $GLOBALS['_boost_nid'] = $node->nid;
+        register_shutdown_function('_boost_view_insert');
+      }
     case 'update':
     case 'delete':
       boost_expire_node($node);
@@ -430,6 +436,31 @@ function boost_nodeapi(&$node, $op, $tea
 }
 
 /**
+ * Shutdown function, gets called at the very end of node creation.
+ *
+ * Node is now created, thus views has access to the new node. Searches all
+ * views for newly created node. Expires those nodes from the cache.
+ */
+function _boost_view_insert() {
+  $result = db_query("SELECT * FROM {boost_cache} WHERE base_dir = '%s' AND page_callback = 'view'", BOOST_FILE_PATH);
+  $data = array();
+  while ($boost = db_fetch_array($result)) {
+    $view = views_get_view($boost['page_type']);
+    $view->set_display($boost['page_id']);
+    $view->pre_execute();
+    $view->set_items_per_page(0);
+    $view->execute();
+    foreach ($view->result as $item) {
+      if ($item->nid == $GLOBALS['_boost_nid']) {
+      $hash = BOOST_FILE_PATH . 'view' . $boost['page_type'] . $boost['page_id'];
+      $data[$hash] = array('base_dir' => BOOST_FILE_PATH, 'page_callback' => 'view', 'page_type' => $boost['page_type'], 'page_id' => $boost['page_id']);
+      }
+    }
+  }
+  boost_cache_expire_router($data);
+}
+
+/**
  * Implementation of hook_votingapi_insert().
  *
  * @param $votes
@@ -1298,7 +1329,7 @@ function boost_cache_expire($paths) {
   // Eliminate duplicates
   $data = array();
   while ($info = db_fetch_array($result)) {
-    $hash = $info['page_callback'] . '-' .  $info['page_type'] . '-' . $info['page_id'];
+    $hash = BOOST_FILE_PATH . $info['page_callback'] . $info['page_type'] . $info['page_id'];
     $data[$hash] = $info;
   }
 
