Skip to content

Instantly share code, notes, and snippets.

@chrisns
Created October 17, 2011 13:42
Show Gist options
  • Save chrisns/1292631 to your computer and use it in GitHub Desktop.
Save chrisns/1292631 to your computer and use it in GitHub Desktop.
forces block cache to be enabled with a node_access module present and keys the cache entries by the $_SERVER['HTTP_HOST']
diff U modules/block/block.module block/block.module
--- modules/block/block.module Mon Jan 19 22:26:36 1970
+++ modules/block/block.module Mon Jan 19 22:26:36 1970
@@ -515,4 +515 @@
- // Try fetching the block from cache. Block caching is not compatible with
- // node_access modules. We also preserve the submission of forms in blocks,
- // by fetching from cache only if the request method is 'GET'.
- if (!count(module_implements('node_grants')) && $_SERVER['REQUEST_METHOD'] == 'GET' && ($cid = _block_get_cache_id($block)) && ($cache = cache_get($cid, 'cache_block'))) {
+ if ($_SERVER['REQUEST_METHOD'] == 'GET' && ($cid = _block_get_cache_id($block)) && ($cache = cache_get($cid, 'cache_block'))) {
@@ -576,0 +574 @@
+ $cid_parts[] = $_SERVER["HTTP_HOST"];
diff U modules/system/system.admin.inc system/system.admin.inc
--- modules/system/system.admin.inc Mon Jan 19 22:26:36 1970
+++ modules/system/system.admin.inc Mon Jan 19 22:26:36 1970
@@ -1336,2 +1336,2 @@
- '#disabled' => count(module_implements('node_grants')),
- '#description' => t('Note that block caching is inactive when modules defining content access restrictions are enabled.'),
+// '#disabled' => count(module_implements('node_grants')),
+// '#description' => t('Note that block caching is inactive when modules defining content access restrictions are enabled.'),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment