Posted by Deciphered on August 26, 2012 at 6:50am
7 followers
| Project: | Chaos tool suite (ctools) |
| Version: | 7.x-1.2 |
| Component: | Code |
| Category: | bug report |
| Priority: | major |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
The introduction of the _ctools_block_load_blocks() function in 1.2, and more likely the code behind that function being introduced, means that you can no longer have Views define a block without having the block module enabled as the query in that function expects the block table to be present.
Ideally, the function should check if the block module is enabled before the query is executed.
Comments
#1
Patch.
#2
I ran into this issue on our site. It broke we when upgrading to ctools-1.2 because it tried to select from the non-existing
blockstable. Applied this patch and it now works.#3
I ran into this same problem and tested out this patch. Works great for me and seems reasonable (i.e. check to see if a module exists before querying its table).
#4
This patch shouldn't alternately invoke hook_block_info -- CTools will already be doing that. Doing so is simply wasteful. If block.module isn't enabled, it simply shouldn't execute the query. It should be able to continue just fine without that query.
#5
Try this simpler patch instead.
#6
@merlinofchaos,
Updated, simpler patch doesn't work, whereas mine did. The new patch gives me a bunch of errors, as such:
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (line 156 of /Users/stuartclark/Sites/customformatters-0.x/profiles/cf_profile/modules/contrib/ctools/plugins/content_types/block/block.inc).Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (line 157 of /Users/stuartclark/Sites/customformatters-0.x/profiles/cf_profile/modules/contrib/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (line 166 of /Users/stuartclark/Sites/customformatters-0.x/profiles/cf_profile/modules/contrib/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_content_render() (line 289 of /Users/stuartclark/Sites/customformatters-0.x/profiles/cf_profile/modules/contrib/ctools/includes/content.inc).
Warning: Attempt to assign property of non-object in ctools_content_render() (line 293 of /Users/stuartclark/Sites/customformatters-0.x/profiles/cf_profile/modules/contrib/ctools/includes/content.inc).
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (line 156 of /Users/stuartclark/Sites/customformatters-0.x/profiles/cf_profile/modules/contrib/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (line 157 of /Users/stuartclark/Sites/customformatters-0.x/profiles/cf_profile/modules/contrib/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (line 166 of /Users/stuartclark/Sites/customformatters-0.x/profiles/cf_profile/modules/contrib/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_content_render() (line 289 of /Users/stuartclark/Sites/customformatters-0.x/profiles/cf_profile/modules/contrib/ctools/includes/content.inc).
Warning: Attempt to assign property of non-object in ctools_content_render() (line 293 of /Users/stuartclark/Sites/customformatters-0.x/profiles/cf_profile/modules/contrib/ctools/includes/content.inc).
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (line 156 of /Users/stuartclark/Sites/customformatters-0.x/profiles/cf_profile/modules/contrib/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (line 157 of /Users/stuartclark/Sites/customformatters-0.x/profiles/cf_profile/modules/contrib/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_block_content_type_render() (line 166 of /Users/stuartclark/Sites/customformatters-0.x/profiles/cf_profile/modules/contrib/ctools/plugins/content_types/block/block.inc).
Warning: Attempt to assign property of non-object in ctools_content_render() (line 289 of /Users/stuartclark/Sites/customformatters-0.x/profiles/cf_profile/modules/contrib/ctools/includes/content.inc).
Warning: Attempt to assign property of non-object in ctools_content_render() (line 293 of /Users/stuartclark/Sites/customformatters-0.x/profiles/cf_profile/modules/contrib/ctools/includes/content.inc).
Basically the functions are expecting populated blocks, which I provided with a simulated alternative to the query. Open to other suggestions for the fix though.
#7
Deciphered: Are you running the latest -dev? Because the errors you are seeing look like they'd only show up prior to http://drupalcode.org/project/ctools.git/commitdiff/03f10455c9ca38c152b3...
#8
No, that was using the patch against CTools 1.2, which is my preferred method when dealing with bugs in stable releases, easy to manage in a makefile than using a commit, however for the purposes of testing this issue I should absolutely have been using the latest dev.
I have updated to the dev and using this patch, it seems to work fine. Apologies for the confusion.
#9
Committed and pushed. Thanks for the testing!
#10
Automatically closed -- issue fixed for 2 weeks with no activity.
#11
this bug, or similar, seems to have resurfaced.
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'care4it.dpl_block' doesn't exist: SELECT b.* FROM {block} b WHERE (b.theme = :db_condition_placeholder_0) ORDER BY b.region ASC, b.weight ASC, b.module ASC; Array ( [:db_condition_placeholder_0] => zen_care4it ) in _ctools_block_load_blocks() (line 101 of /home/care4it/public_html/sites/all/modules/contrib/api/ctools/plugins/content_types/block/block.inc).#1842524: Error: Base table or view not found {block}
i disabled blocks since i'm using a CTools based solution, but some pages are loading system blocks.
so shouldn't be able to turn blocks off
Drupal 7.19
Chaos tool suite (ctools) 7.x-1.2
Panelizer 7.x-3.0-rc1
Panels 7.x-3.3
Panels Everywhere 7.x-1.0-rc1
#12
Have you checked latest -dev? That function has an exit right at the top if block.module is not enabled.
#13
oh, sorry, didn't noticed that 7.x-1.2 was dated august, while the patch commited to dev is dated october.
thanks! i'll assume it's fixed.
#14
This solution do not solves all problems. See http://drupal.org/node/1842524#comment-7092686.