Index: includes/export.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ctools/includes/export.inc,v
retrieving revision 1.19
diff -u -p -r1.19 export.inc
--- includes/export.inc	17 Aug 2009 18:41:04 -0000	1.19
+++ includes/export.inc	11 Sep 2009 10:40:33 -0000
@@ -80,8 +80,7 @@ define('EXPORT_IN_CODE', 0x02);
  *   An array of arguments whose actual use is defined by the $type argument.
  */
 function ctools_export_load_object($table, $type = 'all', $args = array()) {
-  static $cache = array();
-  static $cached_database = array();
+  $cache = ctools_export_static_cache();
 
   $schema = ctools_export_get_schema($table);
   $export = $schema['export'];
@@ -91,7 +90,7 @@ function ctools_export_load_object($tabl
   }
 
   // If fetching all and cached all, we've done so and we are finished.
-  if ($type == 'all' && !empty($cached_database[$table])) {
+  if ($type == 'all' && ctools_export_static_cache('get', $table)) {
     return $cache[$table];
   }
 
@@ -203,7 +202,7 @@ function ctools_export_load_object($tabl
 
   // If fetching all, we've done so and we are finished.
   if ($type == 'all') {
-    $cached_database[$table] = TRUE;
+    ctools_export_static_cache('set', $table);
     return $cache[$table];
   }
 
@@ -220,6 +219,41 @@ function ctools_export_load_object($tabl
 }
 
 /**
+ * Handles the static cache for the exports.
+ *
+ * @param $op
+ *   'set' or 'get' - Together with $table.
+ *   'set': Marked this table fully cached
+ *   'get': Returns TRUE if the table is fully cached
+ * @param $table
+ *   Name of the database table to set a table ready or to adjust the scope of cache retting.
+ * @return
+ *   The reference of the current cache data.
+ */
+function &ctools_export_static_cache($op = NULL, $table = NULL, $reset = FALSE) {
+  static $cache = array();
+  static $fully_cached = array();
+  if ($reset && !empty($table)) {
+    unset($cache[$table]);
+  }
+  elseif ($reset) {
+    unset($cache);
+  }
+  if ($op == 'set') {
+    $fully_cached[$table] = TRUE;
+  }
+  if ($op == 'get') {
+    if (isset($fully_cached[$table])) {
+      return $fully_cached[$table];
+    }
+    else {
+      return FALSE;
+    }
+  }
+  return $cache;
+}
+
+/**
  * Get the default version of an object, if it exists.
  *
  * This function doesn't care if an object is in the database or not and
