You are here

function weather_update_7000 in Weather 7

Removes hardcoded numeric deltas from blocks.

File

./weather.install, line 289
Install, update and uninstall functions for the weather module.

Code

function weather_update_7000(&$sandbox) {

  // Get an array of the renamed block deltas, organized by module.
  $renamed_deltas = array(
    'weather' => array(
      '0' => 'user',
      '1' => 'location',
    ),
  );

  // Determine the highest used block delta of system-wide blocks.
  $max_delta = (int) db_query("SELECT MAX(delta) FROM {block} WHERE module='weather'")
    ->fetchField();

  // Add all possible deltas up to the maximal delta determined above.
  // The system-wide block deltas start at 3, which represents block number 1.
  $delta = 3;
  while ($delta <= $max_delta) {
    $renamed_deltas['weather'][$delta] = 'system_' . ($delta - 2);
    $delta++;
  }
  $moved_deltas = array();
  update_fix_d7_block_deltas($sandbox, $renamed_deltas, $moved_deltas);
}