7.x system.install system_update_7004(&$sandbox)

Remove hardcoded numeric deltas from all blocks in core.

Related topics

File

modules/system/system.install, line 1932
Install, update and uninstall functions for the system module.

Code

function system_update_7004(&$sandbox) {
  
  // Get an array of the renamed block deltas, organized by module.
  $renamed_deltas = array(
    'blog' => array(
      '0' => 'recent',
    ),
    'book' => array(
      '0' => 'navigation',
    ),
    'comment' => array(
      '0' => 'recent',
    ),
    'forum' => array(
      '0' => 'active',
      '1' => 'new',
    ),
    'locale' => array(
      '0' => LANGUAGE_TYPE_INTERFACE,
    ),
    'node' => array(
      '0' => 'syndicate',
    ),
    'poll' => array(
      '0' => 'recent',
    ),
    'profile' => array(
      '0' => 'author-information',
    ),
    'search' => array(
      '0' => 'form',
    ),
    'statistics' => array(
      '0' => 'popular',
    ),
    'system' => array(
      '0' => 'powered-by',
    ),
    'user' => array(
      '0' => 'login',
      '1' => 'navigation',
      '2' => 'new',
      '3' => 'online',
    ),
  );
  $moved_deltas = array(
    'user' => array(
      'navigation' => 'system',
    ),
  );
  
  // Only run this the first time through the batch update.
  if (!isset($sandbox['progress'])) {
    
    // Rename forum module's block variables.
    $forum_block_num_0 = variable_get('forum_block_num_0');
    if (isset($forum_block_num_0)) {
      variable_set('forum_block_num_active', $forum_block_num_0);
      variable_del('forum_block_num_0');
    }
    $forum_block_num_1 = variable_get('forum_block_num_1');
    if (isset($forum_block_num_1)) {
      variable_set('forum_block_num_new', $forum_block_num_1);
      variable_del('forum_block_num_1');
    }
  }
  update_fix_d7_block_deltas($sandbox, $renamed_deltas, $moved_deltas);
}