You are here

function system_update_6027 in Drupal 6

Add block cache.

Related topics

File

modules/system/system.install, line 2100

Code

function system_update_6027() {
  $ret = array();

  // Create the blocks.cache column.
  db_add_field($ret, 'blocks', 'cache', array(
    'type' => 'int',
    'not null' => TRUE,
    'default' => 1,
    'size' => 'tiny',
  ));

  // The cache_block table is created in update_fix_d6_requirements() since
  // calls to cache_clear_all() would otherwise cause warnings.
  // Fill in the values for the new 'cache' column in the {blocks} table.
  foreach (module_list() as $module) {
    if ($module_blocks = module_invoke($module, 'block', 'list')) {
      foreach ($module_blocks as $delta => $block) {
        if (isset($block['cache'])) {
          db_query("UPDATE {blocks} SET cache = %d WHERE module = '%s' AND delta = '%s'", $block['cache'], $module, $delta);
        }
      }
    }
  }
  return $ret;
}