[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/blockcache_alter/patches/ -> blockcache_alter_with_node_grants.patch (source)

   1  --- block.module.orig    2009-03-08 19:34:38.000000000 +0100
   2  +++ block.module    2009-03-18 00:06:58.000000000 +0100
   3  @@ -454,6 +454,7 @@
   4       $blocks[$region] = array();
   5     }
   6   
   7  +  $time = time();
   8     foreach ($blocks[$region] as $key => $block) {
   9       // Render the block content if it has not been created already.
  10       if (!isset($block->content)) {
  11  @@ -466,13 +467,23 @@
  12             // Try fetching the block from cache. Block caching is not compatible with
  13             // node_access modules. We also preserve the submission of forms in blocks,
  14             // by fetching from cache only if the request method is 'GET'.
  15  -          if (!count(module_implements('node_grants')) && $_SERVER['REQUEST_METHOD'] == 'GET' && ($cid = _block_get_cache_id($block)) && ($cache = cache_get($cid, 'cache_block'))) {
  16  +          if (!count(module_implements('node_grants')) && $_SERVER['REQUEST_METHOD'] == 'GET' &&
  17  +            ($cid = _block_get_cache_id($block)) && ($cache = cache_get($cid, 'cache_block')) &&
  18  +            (_blockcache_alter_check_expire($cache, $time))) {
  19               $array = $cache->data;
  20             }
  21             else {
  22               $array = module_invoke($block->module, 'block', 'view', $block->delta);
  23               if (isset($cid)) {
  24  -              cache_set($cid, $array, 'cache_block', CACHE_TEMPORARY);
  25  +              $blocklife = variable_get('bc_life_' . $block->module .'_' . $block->delta, '');
  26  +              $blocklife = (int)$blocklife;
  27  +              if (!empty($blocklife))
  28  +              cache_set($cid, $array, 'cache_block', $blocklife + time());
  29  +              else
  30  +              cache_set($cid, $array, 'cache_block', CACHE_PERMANENT);
  31  +              if (variable_get('bca_debug', FALSE) && user_access('administer site configuration')) {
  32  +                drupal_set_message('Block re-cached: ' . $block->title . '_' .$block->module . '_' . $block->delta . '_' . $blocklife . '_' . time());
  33  +              }
  34               }
  35             }
  36   


Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7