? 761556-domain-form.patch
? 774692-error.patch
? 782208-views-cache.patch
? 785818-domain-batch.patch
? test.patch
? domain_views/782208-cache.patch
Index: domain_views/domain_views.views.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/domain/domain_views/Attic/domain_views.views.inc,v
retrieving revision 1.13
diff -u -p -r1.13 domain_views.views.inc
--- domain_views/domain_views.views.inc	24 Oct 2009 16:18:52 -0000	1.13
+++ domain_views/domain_views.views.inc	30 Apr 2010 17:31:30 -0000
@@ -312,12 +312,22 @@ function domain_views_views_plugins() {
     ),
     'argument default' => array(
       'current_domain' => array(
-        'title' => t("Current domain"),
+        'title' => t('Current domain'),
         'handler' => 'domain_views_plugin_argument_default_current',
         'path' => $path,
         'parent' => 'fixed', // so that the parent class is included
       ),
     ),
+    'cache' => array(
+      'time_per_domain' =>array(
+        'title' => t('Time-based Per Domain'),
+        'help' => t('Time-based caching of views on a per domain basis. This is necessary if you want to cache a view that filters on "current domain".'),
+        'handler' => 'domain_views_plugin_cache_time',
+        'uses options' => TRUE,
+        'path' => $path,
+        'parent' => 'time',
+      ),
+    )
   );
 }
 
Index: domain_views/includes/domain_views_plugin_cache_time.inc
===================================================================
RCS file: domain_views/includes/domain_views_plugin_cache_time.inc
diff -N domain_views/includes/domain_views_plugin_cache_time.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ domain_views/includes/domain_views_plugin_cache_time.inc	30 Apr 2010 17:31:30 -0000
@@ -0,0 +1,76 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ *  Domain Views plugin that caches views on a per domain basis. 
+ *  This is necessary for views that filter on "current domain"
+ *  (ex. SELECT * FROM {node} WHERE domain_source = current_domain)
+ *  otherwise "current domain" will be cached.
+ *
+ * Code by bleen16
+ * @link http://drupal.org/user/77375
+ * @link http://drupal.org/node/782208
+ */
+
+/**
+ * Cache plugin that provides caching on a per domain basis.
+ */
+class domain_views_plugin_cache_time extends views_plugin_cache_time {
+  function summary_title() {
+    // Return a sumary title for the views admin screen (ex. 1 min/1min (Per Domain)).
+    return format_interval($this->options['results_lifespan'], 1) . '/' . format_interval($this->options['output_lifespan'], 1) . ' (Per Domain)';
+  }
+
+  function get_results_key() {
+    /**
+     * Create an md5 hashed key including the current domain
+     * to use as the cache key for caching the views results.
+     */
+    global $user;
+    global $_domain;
+
+    if (!isset($this->_results_key)) {
+      $key_data = array(
+        'build_info' => $this->view->build_info,
+        'roles' => array_keys($user->roles),
+        'super-user' => $user->uid == 1, // Special caching for super user.
+        'language' => $GLOBALS['language'],
+        'domain' => $_domain['domain_id'], // Adding current domain to key data.
+      );
+      foreach (array('exposed_info', 'page', 'sort', 'order') as $key) {
+        if (isset($_GET[$key])) {
+          $key_data[$key] = $_GET[$key];
+        }
+      }
+      // Set the results key.
+      $this->_results_key = $this->view->name . ':' . $this->display->id . ':results:' . md5(serialize($key_data));
+    }
+
+    return $this->_results_key;
+  }
+
+  function get_output_key() {
+    /**
+     * Create an md5 hashed key including the current domain
+     * to use as the cache key for caching the views output.
+     */
+    global $user;
+    global $_domain;
+    
+    if (!isset($this->_output_key)) {
+      $key_data = array(
+        'result' => $this->view->result,
+        'roles' => array_keys($user->roles),
+        'super-user' => $user->uid == 1, // Special caching for super user.
+        'theme' => $GLOBALS['theme'],
+        'language' => $GLOBALS['language'],
+        'domain' => $_domain['domain_id'], // Adding current domain to key data.
+      );
+
+      $this->_output_key = $this->view->name . ':' . $this->display->id . ':output:' . md5(serialize($key_data));
+    }
+
+    return $this->_output_key;
+  }
+}
