diff --git a/core/modules/block/block.module b/core/modules/block/block.module index 34d0905..30e11f8 100644 --- a/core/modules/block/block.module +++ b/core/modules/block/block.module @@ -308,8 +308,9 @@ function _block_get_renderable_region($list = array()) { // the regular 'roles define permissions' schema, it brings too many // chances of having unwanted output get in the cache and later be served // to other users. We therefore exclude user 1 from block caching. - $not_cacheable = $GLOBALS['user']->uid == 1 || - count(module_implements('node_grants')) || + $not_cacheable = + $GLOBALS['user']->uid == 1 || + (!Drupal::config('system.performance')->get('cache.block.bypass_node_grants') && count(module_implements('node_grants'))) || !in_array($_SERVER['REQUEST_METHOD'], array('GET', 'HEAD')); foreach ($list as $key => $block) { diff --git a/core/modules/system/config/system.performance.yml b/core/modules/system/config/system.performance.yml index 0188032..98ff7c9 100644 --- a/core/modules/system/config/system.performance.yml +++ b/core/modules/system/config/system.performance.yml @@ -2,6 +2,8 @@ cache: page: use_internal: '0' max_age: '0' + block: + bypass_node_grants: '0' css: preprocess: '0' gzip: '1' diff --git a/sites/default/default.settings.php b/sites/default/default.settings.php index ab85646..56af5c5 100644 --- a/sites/default/default.settings.php +++ b/sites/default/default.settings.php @@ -586,6 +586,19 @@ # $conf['system.performance']['js']['gzip'] = FALSE; /** + * Block caching: + * + * Block caching may not compatible with node access modules depending on + * how the original block cache policy is defined set by the module that + * provides the block. By default, block cache will be disabled when one or + * more modules implement the hook_node_grant() hook. If you consider block + * caching to be safe on your site, you can bypass this restriction and force + * block caching to the default policy (per block setting) by setting the + * following variable to TRUE. + */ +# $conf['system.performance']['cache']['block']['bypass_node_grants'] = TRUE; + +/** * String overrides: * * To override specific strings on your site with or without enabling the Locale