? sites/default/settings.php Index: includes/update.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/update.inc,v retrieving revision 1.57 diff -u -p -r1.57 update.inc --- includes/update.inc 25 Jun 2010 17:47:22 -0000 1.57 +++ includes/update.inc 26 Jun 2010 07:25:30 -0000 @@ -221,6 +221,7 @@ function update_prepare_d7_bootstrap() {  * An associative array. Keys are module names, values an associative array  * mapping the old block deltas to the new block deltas for the module.  * Example: + * @code  * $renamed_deltas = array(  * 'mymodule' =>  * array( @@ -228,8 +229,21 @@ function update_prepare_d7_bootstrap() {  * 1 => 'mymodule-block-2',  * ),  * ); + * @endcode + * @param $moved_deltas + * An associative array. Keys are source module names, values an associative array + * mappign the (possibly renamed) block name to the new module name. + * Example: + * @code + * $moved_deltas = array( + * 'user' => + * array( + * 'navigation' => 'system', + * ), + * ); + * @endcode  */ -function update_fix_d7_block_deltas(&$sandbox, $renamed_deltas) { +function update_fix_d7_block_deltas(&$sandbox, $renamed_deltas, $moved_deltas) {  // Loop through each block and make changes to the block tables.  // Only run this the first time through the batch update.  if (!isset($sandbox['progress'])) { @@ -253,6 +267,23 @@ function update_fix_d7_block_deltas(&$sa  }  }  } + foreach ($moved_deltas as $old_module => $deltas) { + foreach ($deltas as $delta => $new_module) { + // Only do the update if the old block actually exists. + $block_exists = db_query("SELECT COUNT(*) FROM {" . $table . "} WHERE module = :module AND delta = :delta", array( + ':module' => $old_module, + ':delta' => $delta, + )) + ->fetchField(); + if ($block_exists) { + db_update($table) + ->fields(array('module' => $new_module)) + ->condition('module', $old_module) + ->condition('delta', $delta) + ->execute(); + } + } + }  }    // Initialize batch update information. @@ -282,6 +313,17 @@ function update_fix_d7_block_deltas(&$sa  }  }  } + foreach ($moved_deltas as $old_module => $deltas) { + foreach ($deltas as $delta => $new_module) { + if (isset($data['block'][$old_module][$delta])) { + // Transfer the old block visibility settings to the moved + // block, and mark this user for a database update. + $data['block'][$new_module][$delta] = $data['block'][$old_module][$delta]; + unset($data['block'][$old_module][$delta]); + $user_needs_update = TRUE; + } + } + }  // Update the current user.  if ($user_needs_update) {  db_update('users') Index: modules/system/system.install =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.install,v retrieving revision 1.481 diff -u -p -r1.481 system.install --- modules/system/system.install 25 Jun 2010 17:47:22 -0000 1.481 +++ modules/system/system.install 26 Jun 2010 07:25:31 -0000 @@ -1776,6 +1776,10 @@ function system_update_7004(&$sandbox) {  ),  );   + $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. @@ -1791,7 +1795,7 @@ function system_update_7004(&$sandbox) {  }  }   - update_fix_d7_block_deltas($sandbox, $renamed_deltas); + update_fix_d7_block_deltas($sandbox, $renamed_deltas, $moved_deltas);    }   @@ -1850,14 +1854,14 @@ function system_update_7008() {  }    /** - * Rename the variables for primary and secondary links. - * + * Rename the variable for primary links.  */  function system_update_7009() { - db_update('variable') - ->fields(array('name' => 'main_menu_links_source')) - ->condition('name', 'menu_primary_links_source') - ->execute(); + $current_primary = variable_get('menu_primary_links_source'); + if (isset($current_primary)) { + variable_set('menu_main_links_source', $current_primary); + variable_del('menu_primary_links_source'); + }  }    /** @@ -2426,15 +2430,6 @@ function system_update_7052() {  * Upgrade standard blocks and menus.  */  function system_update_7053() { - // Navigation block is now defined in system module. - if (db_table_exists('block')) { - db_update('block') - ->fields(array('module' => 'system')) - ->condition('module', 'user') - ->condition('delta', 'navigation') - ->execute(); - } -  if (db_table_exists('menu_custom')) {  // Create the same menus as in menu_install().  db_insert('menu_custom') @@ -2445,6 +2440,25 @@ function system_update_7053() {  ->fields(array('menu_name' => 'management', 'title' => 'Management', 'description' => "The Management menu contains links for administrative tasks."))  ->execute();  } + + block_flush_caches(); + + // Show the new menus on themes and places the navigation block is shown + $blocks = db_query("SELECT theme, status, region, weight, visibility, pages FROM {block} WHERE module = 'system' AND delta = 'navigation'"); + foreach ($blocks as $block) { + db_update('block') + ->fields(array( + 'status' => $block->status, + 'region' => $block->region, + 'weight' => $block->weight, + 'visibility' => $block->visibility, + 'pages' => $block->pages, + )) + ->condition('theme', $block->theme) + ->condition('module', 'system') + ->condition(db_or()->condition('delta', 'user-menu')->condition('delta', 'management')) + ->execute(); + }  }    /**