Index: update.php
===================================================================
RCS file: /cvs/drupal/drupal/update.php,v
retrieving revision 1.323
diff -u -p -r1.323 update.php
--- update.php	18 May 2010 18:11:12 -0000	1.323
+++ update.php	14 Aug 2010 01:02:49 -0000
@@ -28,6 +28,16 @@ define('DRUPAL_ROOT', getcwd());
  */
 define('MAINTENANCE_MODE', 'update');
 
+/**
+ * Minimum schema version of Drupal 6 required for upgrade to Drupal 7.
+ *
+ * Upgrades from Drupal 6 to Drupal 7 require that Drupal 6 be running
+ * the most recent version, or the upgrade could fail. We can't easily
+ * check the Drupal 6 version once the update process has begun, so instead
+ * we check the schema version of system.module in the system table.
+ */
+define('REQUIRED_D6_SCHEMA_VERSION', '6055');
+
 function update_selection_page() {
   drupal_set_title('Drupal database update');
   $elements = drupal_get_form('update_script_selection_form');
Index: includes/menu.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/menu.inc,v
retrieving revision 1.404
diff -u -p -r1.404 menu.inc
--- includes/menu.inc	5 Aug 2010 07:56:50 -0000	1.404
+++ includes/menu.inc	14 Aug 2010 01:02:50 -0000
@@ -2123,7 +2123,8 @@ function menu_set_active_trail($new_trai
       // The title of a local task is used for the tab, never the page title.
       // Thus, replace it with the item corresponding to the root path to get
       // the relevant href and title. For example, the menu item corresponding
-      // to 'admin' is used when on the 'By module' tab at 'admin/by-module'.
+      // to 'admin/modules' is used when on the 'Update' tab at
+      // 'admin/modules/update'.
       $parts = explode('/', $item['tab_root']);
       $args = arg();
       // Replace wildcards in the root path using the current path.
Index: includes/update.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/update.inc,v
retrieving revision 1.64
diff -u -p -r1.64 update.inc
--- includes/update.inc	17 Jul 2010 19:44:06 -0000	1.64
+++ includes/update.inc	14 Aug 2010 01:02:50 -0000
@@ -120,6 +120,21 @@ function update_prepare_d7_bootstrap() {
   // created yet.
   drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE);
 
+  // Check to make sure that the user is running an up to date version of
+  // Drupal 6 before proceeding. Note this has to happen AFTER the database
+  // bootstraps because of drupal_get_installed_schema_version().
+  $system_schema = drupal_get_installed_schema_version('system');
+  $has_required_schema = $system_schema >= REQUIRED_D6_SCHEMA_VERSION;
+  $requirements = array(
+    'drupal 6 version' => array(
+      'title' => 'Drupal 6 version',
+      'value' => $has_required_schema ? 'You are running a current version of Drupal 6.' : 'You are not running a current version of Drupal 6',
+      'severity' => $has_required_schema ? REQUIREMENT_OK : REQUIREMENT_ERROR,
+      'description' => $has_required_schema ? '' : 'Please update your Drupal 6 installation to the most recent version before attempting to upgrade to Drupal 7',
+    ),
+  );
+  update_extra_requirements($requirements);
+
   // Create the registry tables.
   if (!db_table_exists('registry')) {
     $schema['registry'] = array(
@@ -148,6 +163,40 @@ function update_prepare_d7_bootstrap() {
     db_create_table('registry_file', $schema['registry_file']);
   }
 
+  if (!db_table_exists('semaphore')) {
+    $semaphore = array(
+      'description' => 'Table for holding semaphores, locks, flags, etc. that cannot be stored as Drupal variables since they must not be cached.',
+      'fields' => array(
+        'name' => array(
+          'description' => 'Primary Key: Unique name.',
+          'type' => 'varchar',
+          'length' => 255,
+          'not null' => TRUE,
+          'default' => ''
+        ),
+        'value' => array(
+          'description' => 'A value for the semaphore.',
+          'type' => 'varchar',
+          'length' => 255,
+          'not null' => TRUE,
+          'default' => ''
+        ),
+        'expire' => array(
+          'description' => 'A Unix timestamp with microseconds indicating when the semaphore should expire.',
+          'type' => 'float',
+          'size' => 'big',
+          'not null' => TRUE
+        ),
+      ),
+      'indexes' => array(
+        'value' => array('value'),
+        'expire' => array('expire'),
+      ),
+      'primary key' => array('name'),
+    );
+    db_create_table('semaphore', $semaphore);
+  }
+
   // The new cache_bootstrap bin is required to bootstrap to
   // DRUPAL_BOOTSTRAP_SESSION, so create it here rather than in
   // update_fix_d7_requirements().
@@ -436,7 +485,7 @@ function update_fix_d7_requirements() {
     db_create_table('role_permission', $schema['role_permission']);
 
     // Drops and recreates semaphore value index.
-    db_drop_index('semaphore', 'expire');
+    db_drop_index('semaphore', 'value');
     db_add_index('semaphore', 'value', array('value'));
 
     $schema['date_format_type'] = array(
Index: modules/dashboard/dashboard.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/dashboard/dashboard.module,v
retrieving revision 1.32
diff -u -p -r1.32 dashboard.module
--- modules/dashboard/dashboard.module	5 Aug 2010 08:39:08 -0000	1.32
+++ modules/dashboard/dashboard.module	14 Aug 2010 01:02:50 -0000
@@ -69,7 +69,7 @@ function dashboard_menu_alter(&$items) {
   $items['admin']['title'] = 'Dashboard';
   $items['admin']['page callback'] = 'dashboard_admin';
   $items['admin/dashboard']['type'] = MENU_DEFAULT_LOCAL_TASK;
-  $items['admin/by-task']['type'] = MENU_LOCAL_TASK;
+  $items['admin/index']['type'] = MENU_LOCAL_TASK;
 }
 
 /**
@@ -87,6 +87,14 @@ function dashboard_block_list_alter(&$bl
       }
     }
   }
+  else {
+    // Since Dashboard takes over the admin page, unset the help text.
+    foreach ($blocks as $key => $block) {
+      if ($block->delta == 'help' && $block->module == 'system') {
+        unset($blocks[$key]);
+      }
+    }
+  }
 }
 
 /**
Index: modules/filter/filter.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.install,v
retrieving revision 1.42
diff -u -p -r1.42 filter.install
--- modules/filter/filter.install	1 Jul 2010 15:14:27 -0000	1.42
+++ modules/filter/filter.install	14 Aug 2010 01:02:50 -0000
@@ -151,6 +151,7 @@ function filter_update_dependencies() {
 
   return $dependencies;
 }
+
 /**
  * @defgroup updates-6.x-to-7.x Filter updates from 6.x to 7.x
  * @{
Index: modules/help/help.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/help/help.admin.inc,v
retrieving revision 1.12
diff -u -p -r1.12 help.admin.inc
--- modules/help/help.admin.inc	30 Jul 2010 02:47:28 -0000	1.12
+++ modules/help/help.admin.inc	14 Aug 2010 01:02:50 -0000
@@ -36,9 +36,13 @@ function help_page($name) {
     // Only print list of administration pages if the module in question has
     // any such pages associated to it.
     $admin_tasks = system_get_module_admin_tasks($name);
+    $links = array();
+    foreach ($admin_tasks as $task) {
+      $links[] = l($task['title'], $task['link_path']);
+    }
+
     if (!empty($admin_tasks)) {
-      ksort($admin_tasks);
-      $output .= theme('item_list', array('items' => $admin_tasks, 'title' => t('@module administration pages', array('@module' => $module['name']))));
+      $output .= theme('item_list', array('items' => $links, 'title' => t('@module administration pages', array('@module' => $module['name']))));
     }
 
   }
Index: modules/locale/locale.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/locale/locale.module,v
retrieving revision 1.297
diff -u -p -r1.297 locale.module
--- modules/locale/locale.module	5 Aug 2010 08:08:43 -0000	1.297
+++ modules/locale/locale.module	14 Aug 2010 01:02:50 -0000
@@ -132,6 +132,7 @@ function locale_menu() {
   );
   $items['admin/config/regional/language/configure/url'] = array(
     'title' => 'URL language detection configuration',
+    'description' => 'Configure URL language detection',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('locale_language_providers_url_form'),
     'access arguments' => array('administer languages'),
@@ -139,6 +140,7 @@ function locale_menu() {
   );
   $items['admin/config/regional/language/configure/session'] = array(
     'title' => 'Session language detection configuration',
+    'description' => 'Configure session language detection',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('locale_language_providers_session_form'),
     'access arguments' => array('administer languages'),
Index: modules/simpletest/simpletest.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/simpletest.info,v
retrieving revision 1.19
diff -u -p -r1.19 simpletest.info
--- modules/simpletest/simpletest.info	30 Jul 2010 01:28:00 -0000	1.19
+++ modules/simpletest/simpletest.info	14 Aug 2010 01:02:50 -0000
@@ -39,4 +39,8 @@ files[] = tests/unicode.test
 files[] = tests/update.test
 files[] = tests/xmlrpc.test
 files[] = tests/upgrade/upgrade.test
+<<<<<<< simpletest.info
+files[] = tests/upgrade/upgrade.taxonomy.test
+=======
 files[] = tests/upgrade/upgrade.poll.test
+>>>>>>> 1.19
Index: modules/system/system.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v
retrieving revision 1.294
diff -u -p -r1.294 system.admin.inc
--- modules/system/system.admin.inc	12 Aug 2010 00:34:25 -0000	1.294
+++ modules/system/system.admin.inc	14 Aug 2010 01:02:51 -0000
@@ -9,70 +9,6 @@
 /**
  * Menu callback; Provide the administration overview page.
  */
-function system_main_admin_page($arg = NULL) {
-  // Only continue if provided arguments are expected. This function serves
-  // as the callback for the top-level admin/ page, so any unexpected arguments
-  // are likely the result of someone typing in the URL of an administrative
-  // page that doesn't actually exist; for example, admin/some/random/page.
-  if (isset($arg) && substr($arg, 0, 3) != 'by-') {
-    return MENU_NOT_FOUND;
-  }
-
-  // Check for status report errors.
-  if (system_status(TRUE) && user_access('administer site configuration')) {
-    drupal_set_message(t('One or more problems were detected with your Drupal installation. Check the <a href="@status">status report</a> for more information.', array('@status' => url('admin/reports/status'))), 'error');
-  }
-  $blocks = array();
-  if ($admin = db_query("SELECT menu_name, mlid FROM {menu_links} WHERE link_path = 'admin' AND module = 'system'")->fetchAssoc()) {
-    $result = db_query("
-      SELECT m.*, ml.*
-      FROM {menu_links} ml
-      INNER JOIN {menu_router} m ON ml.router_path = m.path
-      WHERE ml.link_path != 'admin/help' AND menu_name = :menu_name AND ml.plid = :mlid AND hidden = 0", $admin, array('fetch' => PDO::FETCH_ASSOC));
-    foreach ($result as $item) {
-      _menu_link_translate($item);
-      if (!$item['access']) {
-        continue;
-      }
-      // The link 'description' either derived from the hook_menu 'description'
-      // or entered by the user via menu module is saved as the title attribute.
-      if (!empty($item['localized_options']['attributes']['title'])) {
-        $item['description'] = $item['localized_options']['attributes']['title'];
-      }
-      $block = $item;
-      $block['content'] = '';
-      $block['show'] = FALSE;
-      if ($item['block_callback'] && function_exists($item['block_callback'])) {
-        $function = $item['block_callback'];
-        $block['content'] .= $function();
-      }
-      $content = system_admin_menu_block($item);
-      if ((isset($item['page_callback']) && !in_array($item['page_callback'], array('system_admin_menu_block_page', 'system_admin_config_page', 'system_settings_overview'))) || count($content)) {
-        // Only show blocks for items which are not containers, or those which
-        // are containers and do have items we can show.
-        $block['show'] = TRUE;
-        $block['title'] = l($item['title'], $item['href'], $item['localized_options']);
-        if (!empty($content)) {
-          $block['content'] .= theme('admin_block_content', array('content' => $content));
-        }
-      }
-      // Prepare for sorting as in function _menu_tree_check_access().
-      // The weight is offset so it is always positive, with a uniform 5-digits.
-      $blocks[(50000 + $item['weight']) . ' ' . $item['title'] . ' ' . $item['mlid']] = $block;
-    }
-  }
-  if ($blocks) {
-    ksort($blocks);
-    return theme('admin_page', array('blocks' => $blocks));
-  }
-  else {
-    return t('You do not have any administrative items.');
-  }
-}
-
-/**
- * Menu callback; Provide the administration overview page.
- */
 function system_admin_config_page() {
   // Check for status report errors.
   if (system_status(TRUE) && user_access('administer site configuration')) {
@@ -143,8 +79,24 @@ function system_admin_menu_block_page() 
 
 /**
  * Menu callback; prints a listing of admin tasks for each installed module.
+ *
+ * @param $arg
+ *   Any additional arguments passed through the menu callback.
  */
-function system_admin_by_module() {
+function system_admin_by_module($arg = NULL) {
+  // Only continue if provided arguments are expected. This function serves
+  // as the callback for the top-level admin/ page, so any unexpected arguments
+  // are likely the result of someone typing in the URL of an administrative
+  // page that doesn't actually exist; for example, admin/some/random/page.
+  if (isset($arg)) {
+    return MENU_NOT_FOUND;
+  }
+
+  // Check for status report errors.
+  if (system_status(TRUE) && user_access('administer site configuration')) {
+    drupal_set_message(t('One or more problems were detected with your Drupal installation. Check the <a href="@status">status report</a> for more information.', array('@status' => url('admin/reports/status'))), 'error');
+  }
+
   $module_info = system_get_info('module');
   foreach ($module_info as $module => $info) {
     $module_info[$module] = new stdClass();
@@ -152,26 +104,19 @@ function system_admin_by_module() {
   }
   uasort($module_info, 'system_sort_modules_by_info_name');
   $menu_items = array();
-  $help_arg = module_exists('help') ? drupal_help_arg() : FALSE;
 
   foreach ($module_info as $module => $info) {
-    if ($module == 'help') {
-      continue;
-    }
-
     $admin_tasks = system_get_module_admin_tasks($module);
 
     // Only display a section if there are any available tasks.
     if (count($admin_tasks)) {
-
-      // Check for help links.
-      if ($help_arg && module_invoke($module, 'help', "admin/help#$module", $help_arg)) {
-        $admin_tasks[100] = l(t('Get help'), "admin/help/$module");
-      }
-
       // Sort.
       ksort($admin_tasks);
-
+      // Move 'Configure permissions' links to the bottom of each section.
+      if (isset($admin_tasks[-1]) && $item = $admin_tasks[-1]) {
+        unset($admin_tasks[-1]);
+        array_push($admin_tasks, $item);
+      }
       $menu_items[$info->info['name']] = array($info->info['description'], $admin_tasks);
     }
   }
@@ -2437,7 +2382,6 @@ function theme_system_admin_by_module($v
   $menu_items = $variables['menu_items'];
 
   $stripe = 0;
-  $output = '';
   $container = array('left' => '', 'right' => '');
   $flip = array('left' => 'right', 'right' => 'left');
   $position = 'left';
@@ -2450,7 +2394,7 @@ function theme_system_admin_by_module($v
     if (count($items)) {
       $block = array();
       $block['title'] = $module;
-      $block['content'] = theme('item_list', array('items' => $items));
+      $block['content'] = theme('admin_block_content', array('content' => $items));
       $block['description'] = t($description);
       $block['show'] = TRUE;
 
@@ -2466,6 +2410,7 @@ function theme_system_admin_by_module($v
   }
 
   $output = '<div class="admin clearfix">';
+  $output .= theme('system_compact_link');
   foreach ($container as $id => $data) {
     $output .= '<div class="' . $id . ' clearfix">';
     $output .= $data;
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.953
diff -u -p -r1.953 system.module
--- modules/system/system.module	9 Aug 2010 16:54:50 -0000	1.953
+++ modules/system/system.module	14 Aug 2010 01:02:51 -0000
@@ -87,7 +87,8 @@ function system_help($path, $arg) {
       $output .= '<dd>' . t('Actions are individual tasks that the system can do, such as unpublishing a piece of content or banning a user. Modules, such as the <a href="@trigger-help">Trigger module</a>, can fire these actions when certain system events happen; for example, when a new post is added or when a user logs in. Modules may also provide additional actions. Visit the <a href="@actions">Actions page</a> to configure actions.', array('@trigger-help' => url('admin/help/trigger'), '@actions' => url('admin/config/system/actions'))) . '</dd>';
       $output .= '</dl>';
       return $output;
-    case 'admin/by-module':
+    case 'admin':
+    case 'admin/index':
       return '<p>' . t('This page shows you all available administration tasks for each module.') . '</p>';
     case 'admin/appearance':
       $output = '<p>' . t('Set and configure the default theme for your website.  Alternative <a href="@themes">themes</a> are available.', array('@themes' => 'http://drupal.org/project/themes')) . '</p>';
@@ -523,7 +524,7 @@ function system_menu() {
   $items['admin'] = array(
     'title' => 'Administer',
     'access arguments' => array('access administration pages'),
-    'page callback' => 'system_main_admin_page',
+    'page callback' => 'system_admin_by_module',
     'weight' => 9,
     'menu_name' => 'management',
     'theme callback' => 'variable_get',
@@ -537,19 +538,11 @@ function system_menu() {
     'type' => MENU_CALLBACK,
     'file' => 'system.admin.inc',
   );
-  $items['admin/by-task'] = array(
-    'title' => 'By task',
-    'page callback' => 'system_main_admin_page',
-    'access arguments' => array('access administration pages'),
-    'type' => MENU_DEFAULT_LOCAL_TASK,
-    'file' => 'system.admin.inc',
-  );
-  $items['admin/by-module'] = array(
-    'title' => 'By module',
+  $items['admin/index'] = array(
+    'title' => 'Index',
     'page callback' => 'system_admin_by_module',
     'access arguments' => array('access administration pages'),
-    'type' => MENU_LOCAL_TASK,
-    'weight' => 2,
+    'type' => MENU_DEFAULT_LOCAL_TASK,
     'file' => 'system.admin.inc',
   );
 
@@ -2761,7 +2754,7 @@ function system_get_module_admin_tasks($
   if (empty($items)) {
     $result = db_query("
        SELECT m.load_functions, m.to_arg_functions, m.access_callback, m.access_arguments, m.page_callback, m.page_arguments, m.delivery_callback, m.title, m.title_callback, m.title_arguments, m.theme_callback, m.theme_arguments, m.type, ml.*
-       FROM {menu_links} ml INNER JOIN {menu_router} m ON ml.router_path = m.path WHERE ml.link_path LIKE 'admin/%' AND hidden >= 0 AND module = 'system' AND m.number_parts > 2", array(), array('fetch' => PDO::FETCH_ASSOC));
+       FROM {menu_links} ml INNER JOIN {menu_router} m ON ml.router_path = m.path WHERE ml.link_path LIKE 'admin/%' AND hidden >= 0 AND module = 'system' AND m.number_parts > 1 AND page_callback <> 'system_admin_menu_block_page'", array(), array('fetch' => PDO::FETCH_ASSOC));
     foreach ($result as $item) {
       _menu_link_translate($item);
       if ($item['access']) {
@@ -2774,15 +2767,27 @@ function system_get_module_admin_tasks($
   $admin_tasks = array();
   $admin_task_count = 0;
   // Check for permissions.
+  $permissions_menu_item = menu_get_item('admin/people/permissions');
+  $permissions_menu_item['description'] = NULL;
+  $permissions_menu_item['title'] = t('Configure permissions');
   if (in_array($module, module_implements('permission')) && $admin_access) {
-    $admin_tasks[-1] = l(t('Configure permissions'), 'admin/people/permissions', array('fragment' => 'module-' . $module));
+    $permissions_menu_item['link_path'] = 'admin/people/permissions';
+    $permissions_menu_item['localized_options']['fragment'] = 'module-' . $module;
+    $admin_tasks[-1] = $permissions_menu_item;
   }
-
   // Check for menu items that are admin links.
   if (in_array($module, module_implements('menu')) && $menu = module_invoke($module, 'menu')) {
     foreach (array_keys($menu) as $path) {
       if (isset($items[$path])) {
-        $admin_tasks[$items[$path]['title'] . $admin_task_count ++] = l($items[$path]['title'], $path);
+        // The link 'description' — either derived from the hook_menu
+        // 'description' or entered by the user via menu module — is saved as
+        // the title attribute. The title attribute is then unset to reduce
+        // redundancy in admin pages for screen readers.
+        if (!empty($items[$path]['localized_options']['attributes']['title'])) {
+          $items[$path]['description'] = $items[$path]['localized_options']['attributes']['title'];
+          unset($items[$path]['localized_options']['attributes']['title']);
+        }
+        $admin_tasks[$items[$path]['title'] . $admin_task_count ++] = $items[$path];
       }
     }
   }
Index: modules/taxonomy/taxonomy.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.install,v
retrieving revision 1.43
diff -u -p -r1.43 taxonomy.install
--- modules/taxonomy/taxonomy.install	23 May 2010 19:10:23 -0000	1.43
+++ modules/taxonomy/taxonomy.install	14 Aug 2010 01:02:51 -0000
@@ -394,7 +394,7 @@ function taxonomy_update_7004() {
       field_create_instance($instance);
     }
   }
-  db_drop_table('taxonomy_vocabulary_node_type');
+
   $fields = array('help', 'multiple', 'required', 'tags');
   foreach ($fields as $field) {
     db_drop_field('taxonomy_vocabulary', $field);
@@ -405,15 +405,6 @@ function taxonomy_update_7004() {
  * Migrate {taxonomy_term_node} table to field storage.
  */
 function taxonomy_update_7005(&$sandbox) {
-  // Since we are upgrading from Drupal 6, we know that only
-  // field_sql_storage.module will be enabled.
-  $field = field_info_field($field['field_name']);
-  $data_table = _field_sql_storage_tablename($field);
-  $revision_table = _field_sql_storage_revision_tablename($field);
-  $etid = _field_sql_storage_etid('node');
-  $value_column = $field['field_name'] . '_value';
-  $columns = array('etid', 'entity_id', 'revision_id', 'bundle', 'delta', $value_column);
-
   // This is a multi-pass update. On the first call we need to initialize some
   // variables.
   if (!isset($sandbox['total'])) {
@@ -423,14 +414,51 @@ function taxonomy_update_7005(&$sandbox)
     $query = db_select('taxonomy_term_node', 't');
     $sandbox['total'] = $query->countQuery()->execute()->fetchField();
     $found = (bool) $sandbox['total'];
+    $result = db_query('SELECT v.*, n.type FROM {taxonomy_vocabulary} v LEFT JOIN {taxonomy_vocabulary_node_type} n ON v.vid = n.vid ORDER BY v.weight, v.name');
+    $vocabularies = array();
+    foreach ($result as $record) {
+      // If no node types are associated with a vocabulary, the LEFT JOIN will
+      // return a NULL value for type.
+      if (isset($record->type)) {
+        $node_types[$record->vid][$record->type] = $record->type;
+        unset($record->type);
+        $record->nodes = $node_types[$record->vid];
+      }
+      elseif (!isset($record->nodes)) {
+        $record->nodes = array();
+      }
+      $vocabularies[$record->vid] = $record;
+    }
+    if (!empty($vocabularies)) {
+      $sandbox['vocabularies'] = $vocabularies;
+    }
   }
   else {
+    // Grab the current (first) vocabulary. When this vocabulary's terms have
+    // all been updated, it will be removed from the sandbox.
+    reset($sandbox['vocabularies']);
+    $vid = key($sandbox['vocabularies']);
+    $vocabulary = $sandbox['vocabularies'][$vid];
+
+    // Since we are upgrading from Drupal 6, we know that only
+    // field_sql_storage.module will be enabled.
+    $field = field_info_field('taxonomy_' . $vocabulary->machine_name);
+    $data_table = _field_sql_storage_tablename($field);
+    $revision_table = _field_sql_storage_revision_tablename($field);
+    $etid = _field_sql_storage_etid('node');
+    $value_column = $field['field_name'] . '_tid';
+    $columns = array('etid', 'entity_id', 'revision_id', 'bundle', 'language', 'delta', $value_column);
+
     // We do each pass in batches of 1000, this should result in a
     // maximum of 2000 insert queries each operation.
-    $batch = 1000 + $sandbox['last'];
+    $batch = 1000;
+
+    // Track if we found rows in that run.
+    $found = FALSE;
 
     // Query and save data for the current revision.
-    $result = db_query_range('SELECT td.tid, tn.nid, td.weight, tn.vid, n2.type, n2.created, n2.sticky FROM {taxonomy_term_data} td INNER JOIN {taxonomy_term_node} tn ON td.tid = tn.tid INNER JOIN {node} n2 ON tn.nid = n2.nid INNER JOIN {node} n ON tn.vid = n.vid AND td.vid = :vocabulary_id ORDER BY td.weight ASC', array(':vocabulary_id' => $vocabulary->vid), $sandbox['last'], $batch);
+    $result = db_query_range('SELECT td.tid, tn.nid, td.weight, tn.vid, n2.type, n2.created, n2.sticky FROM {taxonomy_term_data} td INNER JOIN {taxonomy_term_node} tn ON td.tid = tn.tid INNER JOIN {node} n2 ON tn.nid = n2.nid INNER JOIN {node} n ON tn.vid = n.vid AND td.vid = :vocabulary_id ORDER BY td.weight ASC', $sandbox['last'], $batch, array(':vocabulary_id' => $vocabulary->vid));
+
     $deltas = array();
     foreach ($result as $record) {
       $found = TRUE;
@@ -438,7 +466,7 @@ function taxonomy_update_7005(&$sandbox)
       // Start deltas from 0, and increment by one for each
       // term attached to a node.
       $deltas[$record->nid] = isset($deltas[$record->nid]) ? ++$deltas[$record->nid] : 0;
-      $values = array($etid, $record->nid, $record->vid, $record->type, $deltas[$record->nid], $record->tid);
+      $values = array($etid, $record->nid, $record->vid, $record->type, LANGUAGE_NONE, $deltas[$record->nid], $record->tid);
       db_insert($data_table)->fields($columns)->values($values)->execute();
 
       // Update the {taxonomy_index} table.
@@ -449,20 +477,38 @@ function taxonomy_update_7005(&$sandbox)
     }
 
     // Query and save data for all revisions.
-    $result = db_query('SELECT td.tid, tn.nid, td.weight, tn.vid, n.type FROM {taxonomy_term_data} td INNER JOIN {taxonomy_term_node} tn ON td.tid = tn.tid AND td.vid = :vocabulary_id INNER JOIN {node} n ON tn.nid = n.nid ORDER BY td.weight ASC', array(':vocabulary_id' => $vocabulary->vid), $sandbox['last'][$batch]);
+    $result = db_query_range('SELECT td.tid, tn.nid, td.weight, tn.vid, n.type FROM {taxonomy_term_data} td INNER JOIN {taxonomy_term_node} tn ON td.tid = tn.tid AND td.vid = :vocabulary_id INNER JOIN {node} n ON tn.nid = n.nid ORDER BY td.weight ASC', $sandbox['last'], $batch, array(':vocabulary_id' => $vocabulary->vid));
     $deltas = array();
     foreach ($result as $record) {
       $found = TRUE;
       $sandbox['count'] += 1;
       // Start deltas at 0, and increment by one for each term attached to a revision.
       $deltas[$record->vid] = isset($deltas[$record->vid]) ? ++$deltas[$record->vid] : 0;
-      $values = array($etid, $record->nid, $record->vid, $record->type, $deltas[$record->vid], $record->tid);
+      $values = array($etid, $record->nid, $record->vid, $record->type, LANGUAGE_NONE, $deltas[$record->vid], $record->tid);
       db_insert($revision_table)->fields($columns)->values($values)->execute();
     }
-    $sandbox['last'] = $batch;
+
+    $sandbox['last'] += $batch;
+
+    // If there were no rows returned, we're finished with the current vocab.
+    // Advance vid counter and reset batch counter or fall through and finish
+    // if there are no vocabularies left.
+    if (!$found) {
+      unset($sandbox['vocabularies'][$vid]);
+      if (!empty($sandbox['vocabularies'])) {
+        $found = TRUE;
+        $sandbox['last'] = 0;
+      }
+    }
   }
   if (!$found) {
-   db_drop_table('taxonomy_term_node');
+    db_drop_table('taxonomy_vocabulary_node_type');
+    db_drop_table('taxonomy_term_node');
+    // If there are no vocabs, we're done.
+    $sandbox['#finished'] = TRUE;
+  }
+  else {
+    $sandbox['#finished'] = FALSE;
   }
 }
 
Index: modules/user/user.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.admin.inc,v
retrieving revision 1.116
diff -u -p -r1.116 user.admin.inc
--- modules/user/user.admin.inc	29 Jul 2010 01:39:32 -0000	1.116
+++ modules/user/user.admin.inc	14 Aug 2010 01:02:51 -0000
@@ -662,41 +662,32 @@ function user_admin_permissions($form, $
   );
   // Render role/permission overview:
   $options = array();
-  $module_info = system_get_info('module');
   $hide_descriptions = system_admin_compact_mode();
 
-  // Get a list of all the modules implementing a hook_permission() and sort by
-  // display name.
-  $modules = array();
-  foreach (module_implements('permission') as $module) {
-    $modules[$module_info[$module]['name']] = $module;
-  }
-  ksort($modules);
-
-  foreach ($modules as $display_name => $module) {
-    if ($permissions = module_invoke($module, 'permission')) {
-      $form['permission'][] = array(
-        '#markup' => $module_info[$module]['name'],
-        '#id' => $module,
+  $module_info = system_get_info('module');
+
+  foreach (_user_get_permissions() as $module => $permissions) {
+    $form['permission'][] = array(
+      '#markup' => $module_info[$module]['name'],
+      '#id' => $module,
+    );
+    foreach ($permissions as $perm => $perm_item) {
+      // Fill in default values for the permission.
+      $perm_item += array(
+        'description' => '',
+        'restrict access' => FALSE,
+        'warning' => !empty($perm_item['restrict access']) ? t('Warning: Give to trusted roles only; this permission has security implications.') : '',
+      );
+      $options[$perm] = '';
+      $form['permission'][$perm] = array(
+        '#type' => 'item',
+        '#markup' => $perm_item['title'],
+        '#description' => theme('user_permission_description', array('permission_item' => $perm_item, 'hide' => $hide_descriptions)),
       );
-      foreach ($permissions as $perm => $perm_item) {
-        // Fill in default values for the permission.
-        $perm_item += array(
-          'description' => '',
-          'restrict access' => FALSE,
-          'warning' => !empty($perm_item['restrict access']) ? t('Warning: Give to trusted roles only; this permission has security implications.') : '',
-        );
-        $options[$perm] = '';
-        $form['permission'][$perm] = array(
-          '#type' => 'item',
-          '#markup' => $perm_item['title'],
-          '#description' => theme('user_permission_description', array('permission_item' => $perm_item, 'hide' => $hide_descriptions)),
-        );
-        foreach ($role_names as $rid => $name) {
-          // Builds arrays for checked boxes for each role
-          if (isset($role_permissions[$rid][$perm])) {
-            $status[$rid][] = $perm;
-          }
+      foreach ($role_names as $rid => $name) {
+        // Builds arrays for checked boxes for each role
+        if (isset($role_permissions[$rid][$perm])) {
+          $status[$rid][] = $perm;
         }
       }
     }
Index: modules/user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.1192
diff -u -p -r1.1192 user.module
--- modules/user/user.module	11 Aug 2010 14:21:39 -0000	1.1192
+++ modules/user/user.module	14 Aug 2010 01:02:52 -0000
@@ -3678,3 +3678,22 @@ function user_rdf_mapping() {
     ),
   );
 }
+
+/**
+ * Get a list of the modules that implement hook_permission().
+ *
+ * @return $modules
+ *   A cookie name such as 'homepage'.
+ */
+function _user_get_permissions() {
+  // Get a list of all the modules implementing a hook_permission() and sort by
+  // display name.
+  $modules = array();
+
+  foreach (module_implements('permission') as $module) {
+    $modules[$module] = module_invoke($module, 'permission');     ;
+  }
+  ksort($modules);
+  
+  return $modules;
+}
