summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2016-01-30 16:15:35 -0500
committerDavid Rothstein <drothstein@gmail.com>2016-01-30 16:15:35 -0500
commite5b9ebba1790e85a83053dc492e1be4225e4a916 (patch)
tree2372ea38f1a700c4e9356a1c87cdfd6f7d0ff545 /modules
parent405e86103c4aaf258b412699c15c1812f1dd0ae2 (diff)
downloadbrdo-e5b9ebba1790e85a83053dc492e1be4225e4a916.tar.gz
brdo-e5b9ebba1790e85a83053dc492e1be4225e4a916.tar.bz2
Issue #2411917 by chaunceyt: Fix _block_rehash() performance issue
Diffstat (limited to 'modules')
-rw-r--r--modules/block/block.module14
1 files changed, 8 insertions, 6 deletions
diff --git a/modules/block/block.module b/modules/block/block.module
index 405a9537a..d2dde25e9 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -386,18 +386,20 @@ function _block_rehash($theme = NULL) {
// Gather the blocks defined by modules.
foreach (module_implements('block_info') as $module) {
$module_blocks = module_invoke($module, 'block_info');
+ $delta_list = array();
foreach ($module_blocks as $delta => $block) {
// Compile a condition to retrieve this block from the database.
- $condition = db_and()
- ->condition('module', $module)
- ->condition('delta', $delta);
- $or->condition($condition);
// Add identifiers.
+ $delta_list[] = $delta;
$block['module'] = $module;
- $block['delta'] = $delta;
- $block['theme'] = $theme;
+ $block['delta'] = $delta;
+ $block['theme'] = $theme;
$current_blocks[$module][$delta] = $block;
}
+ if (!empty($delta_list)) {
+ $condition = db_and()->condition('module', $module)->condition('delta', $delta_list);
+ $or->condition($condition);
+ }
}
// Save the blocks defined in code for alter context.
$code_blocks = $current_blocks;