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.

Files: 
CommentFileSizeAuthor
#5 1754770-do-not-query-block-table-if-no-block-module.patch548 bytesmerlinofchaos
PASSED: [[SimpleTest]]: [MySQL] 67 pass(es).
[ View ]
#1 blocks_dependency_issue-1754770-1.patch1.96 KBDeciphered
PASSED: [[SimpleTest]]: [MySQL] 67 pass(es).
[ View ]

Comments

Status:Active» Needs review
StatusFileSize
new1.96 KB
PASSED: [[SimpleTest]]: [MySQL] 67 pass(es).
[ View ]

Patch.

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 blocks table. Applied this patch and it now works.

Status:Needs review» Reviewed & tested by the community

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).

Status:Reviewed & tested by the community» Needs work

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.

Status:Needs work» Needs review
StatusFileSize
new548 bytes
PASSED: [[SimpleTest]]: [MySQL] 67 pass(es).
[ View ]

Try this simpler patch instead.

Status:Needs review» Needs work

@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.

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...

Status:Needs work» Reviewed & tested by the community

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.

Status:Reviewed & tested by the community» Fixed

Committed and pushed. Thanks for the testing!

Status:Fixed» Closed (fixed)

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

Status:Closed (fixed)» Active

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

Have you checked latest -dev? That function has an exit right at the top if block.module is not enabled.

Status:Active» Fixed

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.

Status:Fixed» Active

This solution do not solves all problems. See http://drupal.org/node/1842524#comment-7092686.