#232037 by pwolanin: (performance) block regions should only be populated when called for, not in all cases (fixes performance expectation on 403/404 pages)
parent
73eff99bf4
commit
fe554d302f
|
@ -684,8 +684,23 @@ function block_list($region) {
|
||||||
else {
|
else {
|
||||||
$page_match = TRUE;
|
$page_match = TRUE;
|
||||||
}
|
}
|
||||||
|
$block->enabled = $enabled;
|
||||||
|
$block->page_match = $page_match;
|
||||||
|
$blocks[$block->region]["{$block->module}_{$block->delta}"] = $block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($enabled && $page_match) {
|
// Create an empty array if there were no entries
|
||||||
|
if (!isset($blocks[$region])) {
|
||||||
|
$blocks[$region] = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($blocks[$region] as $key => $block) {
|
||||||
|
// Render the block content if it has not been created already.
|
||||||
|
if (!isset($block->content)) {
|
||||||
|
// Erase the block from the static array - we'll put it back if it has content.
|
||||||
|
unset($blocks[$region][$key]);
|
||||||
|
if ($block->enabled && $block->page_match) {
|
||||||
// Check the current throttle status and see if block should be displayed
|
// Check the current throttle status and see if block should be displayed
|
||||||
// based on server load.
|
// based on server load.
|
||||||
if (!($block->throttle && (module_invoke('throttle', 'status') > 0))) {
|
if (!($block->throttle && (module_invoke('throttle', 'status') > 0))) {
|
||||||
|
@ -707,9 +722,5 @@ function block_list($region) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Create an empty array if there were no entries
|
|
||||||
if (!isset($blocks[$region])) {
|
|
||||||
$blocks[$region] = array();
|
|
||||||
}
|
|
||||||
return $blocks[$region];
|
return $blocks[$region];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue