? drupal-7-upgrade-927860-1.patch
? drupal-7-upgrade-927860-2.patch
Index: varnish.info
===================================================================
RCS file: /cvs/drupal/contributions/modules/varnish/varnish.info,v
retrieving revision 1.2
diff -u -p -r1.2 varnish.info
--- varnish.info	4 May 2010 16:08:53 -0000	1.2
+++ varnish.info	5 Oct 2010 14:25:54 -0000
@@ -1,5 +1,5 @@
 ; $Id: varnish.info,v 1.2 2010/05/04 16:08:53 joshk Exp $
 name = Varnish 
 description = "Provides integration with the Varnish HTTP accelerator."
-core = 6.x
+core = 7.x
 package = Caching
\ No newline at end of file
Index: varnish.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/varnish/varnish.module,v
retrieving revision 1.23
diff -u -p -r1.23 varnish.module
--- varnish.module	19 Jul 2010 19:10:37 -0000	1.23
+++ varnish.module	5 Oct 2010 14:25:54 -0000
@@ -37,12 +37,15 @@ function varnish_menu() {
 }
 
 /** 
- * Implemetation of hook_perm()
- *
- * Allows admins to control access to varnish settings.
+ * Implemetation of hook_permission()
  */
-function varnish_perm() {
-  return array('administer varnish');
+function varnish_permission() {
+  return array(
+    'administer varnish' =>  array(
+      'title' => t('Administer varnish'),
+      'description' => t('Perform administration tasks for varnish.'),
+    ),
+  );
 }
 
 /**
@@ -75,39 +78,59 @@ function varnish_requirements($phase) {
 }
 
 /**
- * Implementation of hook_nodeapi()
- *
- * Used to pick up cache_clearing events
+ * Implementation of hook_node_insert().
  */
-function varnish_nodeapi(&$node, $op) {
-  if ($op == 'insert' || $op == 'update') {
-    // We've probably just run through node_save, and normally this is where
-    // Drupal calls a cache_clear_all().
-    switch (variable_get('varnish_cache_clear', VARNISH_DEFAULT_CLEAR)) {
-      case VARNISH_DEFAULT_CLEAR:
-        varnish_purge_all_pages();
-        break;
-    }
-  }
+function varnish_node_insert($node) {
+  variable_get('varnish_cache_clear', VARNISH_DEFAULT_CLEAR) ? varnish_purge_all_pages() : FALSE;
 }
 
 /**
- * Implementation of hook_comment()
- *
- * Used to pick up cache_clearing events
+ * Implementation of hook_node_update().
  */
-function varnish_comment($comment, $op) {
-  switch ($op) {
-    case 'insert':
-    case 'update':
-    case 'publish':
-    case 'unpublish':
-    case 'delete':
-      if (variable_get('varnish_cache_clear', VARNISH_DEFAULT_CLEAR) == VARNISH_DEFAULT_CLEAR) {
-        varnish_purge_all_pages();
-      }
-      break;
-  }
+function varnish_node_update($node) {
+  variable_get('varnish_cache_clear', VARNISH_DEFAULT_CLEAR) ? varnish_purge_all_pages() : FALSE;
+}
+
+/**
+ * Implementation of hook_node_delete().
+ */
+function varnish_node_delete($node) {
+  variable_get('varnish_cache_clear', VARNISH_DEFAULT_CLEAR) ? varnish_purge_all_pages() : FALSE;
+}
+
+/**
+ * Implementation of hook_comment_insert().
+ */
+function varnish_comment_insert($comment) {
+  variable_get('varnish_cache_clear', VARNISH_DEFAULT_CLEAR) ? varnish_purge_all_pages() : FALSE;
+}
+
+/**
+ * Implementation of hook_comment_update().
+ */
+function varnish_comment_update($comment) {
+  variable_get('varnish_cache_clear', VARNISH_DEFAULT_CLEAR) ? varnish_purge_all_pages() : FALSE;
+}
+
+/**
+ * Implementation of hook_comment_publish().
+ */
+function varnish_comment_publish($comment) {
+  variable_get('varnish_cache_clear', VARNISH_DEFAULT_CLEAR) ? varnish_purge_all_pages() : FALSE;
+}
+
+/**
+ * Implementation of hook_comment_unpublish().
+ */
+function varnish_comment_unpublish($comment) {
+  variable_get('varnish_cache_clear', VARNISH_DEFAULT_CLEAR) ? varnish_purge_all_pages() : FALSE;
+}
+
+/**
+ * Implementation of hook_comment_delete().
+ */
+function varnish_comment_delete($comment) {
+  variable_get('varnish_cache_clear', VARNISH_DEFAULT_CLEAR) ? varnish_purge_all_pages() : FALSE;
 }
 
 /**
@@ -116,6 +139,8 @@ function varnish_comment($comment, $op) 
  * Takes an array from expire.module and issue purges.
  *
  * You may also safely call this function directly with an array of local urls to purge.
+ * 
+ * //@TODO update expire.module to drupal 7?
  */
 function varnish_expire_cache($paths) {
   $host = _varnish_get_host();
