After reverting a bean_type exported with features, it still appears as reverted in the bean admin UI (not in features).

To replicate:

* create a bean type
* export with features
* edit and change description so it gets overridden
* revert with features
* visit bean admin ui

Only a flush of all caches allows to show the correct status of the bean type.

Files: 
CommentFileSizeAuthor
#3 bean-1786036.patch5.31 KBjonhattan
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch bean-1786036.patch. Unable to apply patch. See the log in the details link for more information. View
#1 bean-1786036.patch5.25 KBjonhattan
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch bean-1786036_1.patch. Unable to apply patch. See the log in the details link for more information. View

Comments

jonhattan’s picture

FileSize
5.25 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch bean-1786036_1.patch. Unable to apply patch. See the log in the details link for more information. View

Several changes proposed in this patch:

* hook_bean_cache_clear(), invoked from bean_reset() so each module is responsible to clean its own caches.
* adjusted ctools caches needed to be cleared.
* provide bean_type_features_revert() to have the chance to bean_reset() after revert.
* Removed bean_admin_ui_get_types() and call directly to ctools_export_load_object() since it already caches.

jonhattan’s picture

Status: Active » Needs review
jonhattan’s picture

FileSize
5.31 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch bean-1786036.patch. Unable to apply patch. See the log in the details link for more information. View

needed a call to ctools_include('export').

note on this:

+++ b/bean_admin_ui/bean_admin_ui.moduleundefined
@@ -99,34 +100,14 @@ function bean_admin_ui_bean_types() {
-      // In install profiles, this function can get called before Drupal's created
-      // our database tables (see http://drupal.org/node/1179420), so don't crash
-      // Drupal installation by trying to get bean types; if we did, we'd query a
-      // nonexistent table.
-      if (defined('MAINTENANCE_MODE') && MAINTENANCE_MODE == 'install' &&
-        drupal_get_installed_schema_version('bean_admin_ui', TRUE) == SCHEMA_UNINSTALLED) {
-        $bean_types = array();

I actually use this patch from a feature in install profile.

indytechcook’s picture

Status: Needs review » Needs work

Thanks jonhattan. Good to see that you are working on features, it's not something that I use.

Most of this looks good. I do want to keep bean_admin_ui_get_types() as removing it would be an API change and that's something I'd like to avoid since were in a RC. Removing the extra layer of caching is a good idea though.

+++ b/bean_admin_ui/bean_admin_ui.moduleundefined
@@ -80,9 +82,9 @@ function bean_admin_ui_bean_types_api_info() {
-  $bean_types = bean_admin_ui_get_types();
+  ctools_include('export');

Keep bean_admin_ui_get_types()

+++ b/bean_admin_ui/bean_admin_ui.moduleundefined
@@ -99,34 +101,15 @@ function bean_admin_ui_bean_types() {
-function bean_admin_ui_get_types() {
-  $bean_types = &drupal_static(__FUNCTION__);
-
-  if (empty($bean_types)) {
-    $cache = cache_get('bean_types');
-    if (empty($cache->data)) {
-      // In install profiles, this function can get called before Drupal's created
-      // our database tables (see http://drupal.org/node/1179420), so don't crash
-      // Drupal installation by trying to get bean types; if we did, we'd query a
-      // nonexistent table.
-      if (defined('MAINTENANCE_MODE') && MAINTENANCE_MODE == 'install' &&
-        drupal_get_installed_schema_version('bean_admin_ui', TRUE) == SCHEMA_UNINSTALLED) {
-        $bean_types = array();
-      }
-      else {
-        ctools_include('export');
-        $bean_types = ctools_export_load_object('bean_type');
-        cache_set('bean_types', $bean_types);
-      }
-    }
-    else {
-      $bean_types = $cache->data;
-    }

Keep but get rid of extra caching layer.

+++ b/bean_admin_ui/includes/features.incundefined
@@ -18,3 +18,11 @@ function bean_admin_ui_features_pipe_bean_type_alter(&$pipe, $data, $export) {
+/**
+ * Implements {component}_features_revert().
+ */
+function bean_type_features_revert($module, $component) {
+  ctools_component_features_revert($component, $module);
+  bean_reset();

This looks like it's part of the features revert patch.

indytechcook’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.