summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Barth2009-10-09 21:30:09 (GMT)
committer Alex Barth2009-10-09 21:30:09 (GMT)
commit8dec51df84b9c3342bf4bb032f70e29c3c9423d3 (patch)
tree8494f8cd469875fafce0727593fa46950f3232a2
parentc2e578fffb9978c22d956a0b5192e27b70c6ba9c (diff)
Clear views / menu caches after creating a table, clear views cache after adding a field.
-rw-r--r--includes/DataTable.inc14
1 files changed, 14 insertions, 0 deletions
diff --git a/includes/DataTable.inc b/includes/DataTable.inc
index 75563f6..3292fcb 100644
--- a/includes/DataTable.inc
+++ b/includes/DataTable.inc
@@ -116,6 +116,16 @@ class DataTable {
// Clear caches.
drupal_get_schema($this->name, TRUE);
+ // Have views read new views information about table.
+ if (module_exists('views')) {
+ views_invalidate_cache();
+ }
+
+ // data ui exposes path to a new default view.
+ if (module_exists('data_ui')) {
+ menu_rebuild();
+ }
+
return TRUE;
}
return FALSE;
@@ -201,6 +211,10 @@ class DataTable {
// @todo: maybe move these cache clearing functions to their own method
// and let take API users take care of caching.
drupal_get_schema($this->name, TRUE);
+ // Invalidate views caches to use new field immediately.
+ if (function_exists('views_invalidate_cache')) {
+ views_invalidate_cache();
+ }
return $field;
}
return FALSE;