summaryrefslogtreecommitdiff
path: root/modules/block
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2013-06-03 23:52:33 -0400
committerDavid Rothstein <drothstein@gmail.com>2013-06-03 23:52:33 -0400
commit5ae8828fef1b17c5ac412b8a47a7be7cb75d9144 (patch)
tree635542947fc5aadfe67aee0b3912b7e54b6c5aaa /modules/block
parentad00b256bd5a9507f096277fa11016fa55b48a7a (diff)
downloadbrdo-5ae8828fef1b17c5ac412b8a47a7be7cb75d9144.tar.gz
brdo-5ae8828fef1b17c5ac412b8a47a7be7cb75d9144.tar.bz2
Revert "Issue #1956914 by chaby, pounard: Use a single cache_get_multiple() call per region instead of a cache_get() per block in _block_render_blocks()."
This reverts commit 43c8918f96612d6ab37e8ca122e0f7c0ac4520a1.
Diffstat (limited to 'modules/block')
-rw-r--r--modules/block/block.module28
1 files changed, 3 insertions, 25 deletions
diff --git a/modules/block/block.module b/modules/block/block.module
index 70b1d4260..ff77d9ec3 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -840,37 +840,15 @@ function _block_render_blocks($region_blocks) {
// preserve the submission of forms in blocks, by fetching from cache only
// if the request method is 'GET' (or 'HEAD').
$cacheable = !count(module_implements('node_grants')) && ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'HEAD');
-
- // Proceed to a loop over all blocks in order to compute their respective
- // cache identifiers, this allows us to do one single cache_get_multiple()
- // call instead of doing one cache_get() call per block.
- $cached_blocks = array();
- if ($cacheable) {
-
- $cids = array();
- foreach ($region_blocks as $key => $block) {
- if (!isset($block->content)) {
- if (($cid = _block_get_cache_id($block))) {
- $cids[] = $cid;
- }
- }
- }
-
- if ($cids) {
- $cached_blocks = cache_get_multiple($cids, 'cache_block');
- }
- }
-
foreach ($region_blocks 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($region_blocks[$key]);
-
- // Try fetching the block from the previously loaded cache entries.
- if (($cid = _block_get_cache_id($block)) && isset($cached_blocks[$cid])) {
- $array = $cached_blocks[$cid]->data;
+ // Try fetching the block from cache.
+ if ($cacheable && ($cid = _block_get_cache_id($block)) && ($cache = cache_get($cid, 'cache_block'))) {
+ $array = $cache->data;
}
else {
$array = module_invoke($block->module, 'block_view', $block->delta);