? includes/database/.schema.inc.swp
? modules/includes
? modules/modules
? modules/locale/.locale.test.swp
? sites/example.sites.php
? sites/default/files
? sites/default/settings.php
Index: includes/update.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/update.inc,v
retrieving revision 1.62
diff -u -p -r1.62 update.inc
--- includes/update.inc	10 Jul 2010 17:27:50 -0000	1.62
+++ includes/update.inc	12 Jul 2010 06:53:29 -0000
@@ -220,6 +220,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(
@@ -227,8 +228,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 mapping 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'])) {
@@ -239,10 +253,10 @@ function update_fix_d7_block_deltas(&$sa
         foreach ($deltas as $old_delta => $new_delta) {
           // 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' => $module,
-            ':delta' => $old_delta,
-          ))
-          ->fetchField();
+              ':module' => $module,
+              ':delta' => $old_delta,
+            ))
+            ->fetchField();
           if ($block_exists) {
             db_update($table)
               ->fields(array('delta' => $new_delta))
@@ -252,6 +266,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.
@@ -281,6 +312,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.489
diff -u -p -r1.489 system.install
--- modules/system/system.install	10 Jul 2010 01:57:32 -0000	1.489
+++ modules/system/system.install	12 Jul 2010 06:53:30 -0000
@@ -1632,6 +1632,17 @@ function system_update_last_removed() {
 }
 
 /**
+ * Implements hook_update_dependencies().
+ */
+function system_update_dependencies() {
+  // Update 7053 adds new blocks, so make sure the block tables are updated.
+  $dependencies['system'][7053] = array(
+    'block' => 7002,
+  );
+
+  return $dependencies;
+}
+/**
  * @defgroup updates-6.x-to-7.x System updates from 6.x to 7.x
  * @{
  */
@@ -1770,6 +1781,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.
@@ -1785,7 +1800,7 @@ function system_update_7004(&$sandbox) {
     }
   }
 
-  update_fix_d7_block_deltas($sandbox, $renamed_deltas);
+  update_fix_d7_block_deltas($sandbox, $renamed_deltas, $moved_deltas);
 
 }
 
@@ -1844,14 +1859,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');
+  }
 }
 
 /**
@@ -2400,15 +2415,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')
@@ -2419,6 +2425,29 @@ function system_update_7053() {
       ->fields(array('menu_name' => 'management', 'title' => 'Management', 'description' => "The <em>Management</em> menu contains links for administrative tasks."))
       ->execute();
   }
+
+  block_flush_caches();
+
+  // Show the new menu blocks along the navigation block.
+  $blocks = db_query("SELECT theme, status, region, weight, visibility, pages FROM {block} WHERE module = 'system' AND delta = 'navigation'");
+  $deltas = db_or()
+    ->condition('delta', 'user-menu')
+    ->condition('delta', 'management');
+
+  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($deltas)
+      ->execute();
+  }
 }
 
 /**
