Closed (fixed)
Project:
Bean (for Drupal 7)
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
18 Jan 2013 at 04:52 UTC
Updated:
21 Oct 2013 at 13:27 UTC
Jump to comment: Most recent file
Comments
Comment #1
indytechcook commentedI've used blockreference very extensively with bean on several projects. Could you please elaborate on "bean blocks do not show up as options"?
Comment #2
rooby commentedIt seems like my bean install had somehow messed itself, because I was also having other issues that others could not reproduce.
I am now running rc9 with no ill effects and blockreference is picking them up.
Comment #3
rooby commentedComment #4
jeffamI can confirm that this is an existing issue or regression. I just updated the bean module from 1.0-rc6 to 1.0 and entity from 1.0-rc3 to 1.0. Before the update, newly created beans would appear in blockreference fields. After the update, they don't appear until I clear the cache.
I noticed that after the creation of a bean with the updated modules, the new bean does not appear in the blocks table, which is what block reference uses as its source. When I create a new bean with the older version of the modules, the new bean does appear in the blocks table immediately upon creation.
I'm also not sure why a cache clear would populate the blocks table, but that's what seems to happen.
To reproduce the issue outside of my existing site, I did the following:
I'll keep digging around, but I wanted to put this out there in the hope that the module devs will notice something simple and obvious.
Comment #5
jeffamJust to confirm that this wasn't an issue with the update to entity, I ran the same test as above but with bean 1.0-rc6 and entity 1.0. With that combo, the new beans appear in the blocks table immediately upon save and are therefore available to blockreference fields.
Then I updated to bean 1.0-rc7 and the issue appeared. New beans no longer appear immediately in the blocks table. Odd, since that release was way back in December, and I'd think the issue would've been noticed by now. I can't help but wonder if something else is going on.
Comment #6
jeffamFound it. In rc7 block_flush_caches() was removed from Bean::save(). Here's a patch that puts it back.
Comment #7
jeffamComment #8
saltednutWhat's the overhead of calling
block_flush_caches()every time a bean is saved? Just trying to figure out why this was removed to begin with...Comment #9
saltednutComment #10
jeffamI can't imagine that it's much. Beans are saved a lot less often than they are viewed. I'm using the patch on several sites that use the bean/blockreference combo, and there is no apparent delay when beans are created or edited.
And without this patch, there can be real problems using beans with blockreference fields - new beans just don't show up in the list of available blocks.
Comment #11
rooby commentedIt's not so much the delay of saving the bean (clearing the cache), but the extra time spent on subsequent page loads as the cache regenerates.
It really depends on the site as to whether that matters much or not.
But if it's needed it's needed.
Comment #12
saltednutCache ttl is usually like 5 min anyway. I doubt many sites are rebuilding block configurations that much. I'm ok with committing this if we can get an RTBC on it. I've not used blockreference before so perhaps someone with some experience using the module can test this?
Comment #13
donutdan4114 commentedTested with Block Reference, was able to put beans within beans, and put beans into other node types using block reference field.
Comment #14
saltednutI think you meant RTBC, right? :) (Maintainers use 'fixed' after the patch is committed.)
Comment #15
indytechcook commentedI very wary of adding the rehash at this step as I feel it will cause a significant performance issue but I see no way around it.
What's interesting is that block_flush_caches() was actually in the code but was removed somewhere, probably during the cache clear refactor.
I committed the concept but a little different implementation.
Comment #17
spadxiii commentedFor people looking for the committed patch: http://drupalcode.org/project/bean.git/commitdiff_plain/bd5b498