Index: modules/aggregator/aggregator.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.info,v
retrieving revision 1.12
diff -u -p -r1.12 aggregator.info
--- modules/aggregator/aggregator.info	8 Jun 2009 09:23:50 -0000	1.12
+++ modules/aggregator/aggregator.info	20 Jun 2009 19:43:58 -0000
@@ -12,3 +12,4 @@ files[] = aggregator.parser.inc
 files[] = aggregator.processor.inc
 files[] = aggregator.install
 files[] = aggregator.test
+files[] = aggregator.update.inc
Index: modules/aggregator/aggregator.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.install,v
retrieving revision 1.24
diff -u -p -r1.24 aggregator.install
--- modules/aggregator/aggregator.install	5 Jun 2009 05:28:28 -0000	1.24
+++ modules/aggregator/aggregator.install	20 Jun 2009 19:43:58 -0000
@@ -273,17 +273,3 @@ function aggregator_schema() {
   return $schema;
 }
 
-/**
- * Add hash column to aggregator_feed table.
- */
-function aggregator_update_7000() {
-  $ret = array();
-  db_add_field($ret, 'aggregator_feed', 'hash', array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''));
-  return $ret;
-}
-/**
- * Add aggregator teaser length to settings from old global default teaser length
- */
-function aggregator_update_7001() {
-  variable_set('aggregator_teaser_length', variable_get('teaser_length'));
-}
Index: modules/aggregator/aggregator.update.inc
===================================================================
RCS file: modules/aggregator/aggregator.update.inc
diff -N modules/aggregator/aggregator.update.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/aggregator/aggregator.update.inc	20 Jun 2009 19:43:58 -0000
@@ -0,0 +1,22 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Update functions for Aggregator module.
+ */
+
+/**
+ * Add hash column to aggregator_feed table.
+ */
+function aggregator_update_7000() {
+  $ret = array();
+  db_add_field($ret, 'aggregator_feed', 'hash', array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''));
+  return $ret;
+}
+/**
+ * Add aggregator teaser length to settings from old global default teaser length
+ */
+function aggregator_update_7001() {
+  variable_set('aggregator_teaser_length', variable_get('teaser_length'));
+}
Index: modules/block/block.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/block/block.info,v
retrieving revision 1.13
diff -u -p -r1.13 block.info
--- modules/block/block.info	8 Jun 2009 09:23:50 -0000	1.13
+++ modules/block/block.info	20 Jun 2009 19:43:58 -0000
@@ -9,3 +9,4 @@ files[] = block.module
 files[] = block.admin.inc
 files[] = block.install
 files[] = block.test
+files[] = block.update.inc
Index: modules/block/block.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/block/block.install,v
retrieving revision 1.27
diff -u -p -r1.27 block.install
--- modules/block/block.install	28 May 2009 11:31:20 -0000	1.27
+++ modules/block/block.install	20 Jun 2009 19:43:58 -0000
@@ -195,15 +195,3 @@ function block_uninstall() {
   drupal_uninstall_schema('block');
 }
 
-/**
- * Set system.weight to a low value for block module.
- *
- * Block should go first so that other modules can alter its output
- * during hook_page_alter(). Almost everything on the page is a block,
- * so before block module runs, there will not be much to alter.
- */
-function block_update_7000() {
-  $ret = array();
-  $ret[] = update_sql("UPDATE {system} SET weight = -5 WHERE name = 'block'");
-  return $ret;
-}
Index: modules/block/block.update.inc
===================================================================
RCS file: modules/block/block.update.inc
diff -N modules/block/block.update.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/block/block.update.inc	20 Jun 2009 19:43:58 -0000
@@ -0,0 +1,20 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Update functions for Block module.
+ */
+
+/**
+ * Set system.weight to a low value for block module.
+ *
+ * Block should go first so that other modules can alter its output
+ * during hook_page_alter(). Almost everything on the page is a block,
+ * so before block module runs, there will not be much to alter.
+ */
+function block_update_7000() {
+  $ret = array();
+  $ret[] = update_sql("UPDATE {system} SET weight = -5 WHERE name = 'block'");
+  return $ret;
+}
Index: modules/blogapi/blogapi.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/blogapi/blogapi.info,v
retrieving revision 1.10
diff -u -p -r1.10 blogapi.info
--- modules/blogapi/blogapi.info	8 Jun 2009 09:23:51 -0000	1.10
+++ modules/blogapi/blogapi.info	20 Jun 2009 19:43:58 -0000
@@ -8,3 +8,4 @@ core = 7.x
 files[] = blogapi.module
 files[] = blogapi.install
 files[] = blogapi.test
+files[] = blogapi.update.inc
Index: modules/blogapi/blogapi.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/blogapi/blogapi.install,v
retrieving revision 1.9
diff -u -p -r1.9 blogapi.install
--- modules/blogapi/blogapi.install	1 Jun 2009 22:07:08 -0000	1.9
+++ modules/blogapi/blogapi.install	20 Jun 2009 19:43:58 -0000
@@ -74,30 +74,6 @@ function blogapi_schema() {
  */
 
 /**
- * Inform users about the new permission.
- */
-function blogapi_update_6000() {
-  drupal_set_message("Blog API module does not depend on blog module's permissions anymore, but provides its own 'administer content with blog api' permission instead. Until <a href=\"" . url('admin/user/permissions', array('fragment' => 'module-blogapi')) . '">this permission is assigned</a> to at least one user role, only the site administrator will be able to use Blog API features.');
-  return array();
-}
-
-/**
- * Add blogapi_files table to enable size restriction for BlogAPI file uploads.
- *
- * This table was introduced in Drupal 6.4.
- */
-function blogapi_update_6001() {
-  $ret = array();
-
-  if (!db_table_exists('blogapi_files')) {
-    $schema = blogapi_schema();
-    db_create_table($ret, 'blogapi_files', $schema['blogapi_files']);
-  }
-
-  return $ret;
-}
-
-/**
  * @} End of "defgroup updates-5.x-to-6.x"
  * The next series of updates should start at 7000.
  */
Index: modules/blogapi/blogapi.update.inc
===================================================================
RCS file: modules/blogapi/blogapi.update.inc
diff -N modules/blogapi/blogapi.update.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/blogapi/blogapi.update.inc	20 Jun 2009 19:43:58 -0000
@@ -0,0 +1,32 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Update functions for Blogapi module.
+ */
+
+/**
+ * Inform users about the new permission.
+ */
+function blogapi_update_6000() {
+  drupal_set_message("Blog API module does not depend on blog module's permissions anymore, but provides its own 'administer content with blog api' permission instead. Until <a href=\"" . url('admin/user/permissions', array('fragment' => 'module-blogapi')) . '">this permission is assigned</a> to at least one user role, only the site administrator will be able to use Blog API features.');
+  return array();
+}
+
+/**
+ * Add blogapi_files table to enable size restriction for BlogAPI file uploads.
+ *
+ * This table was introduced in Drupal 6.4.
+ */
+function blogapi_update_6001() {
+  $ret = array();
+
+  if (!db_table_exists('blogapi_files')) {
+    $schema = blogapi_schema();
+    db_create_table($ret, 'blogapi_files', $schema['blogapi_files']);
+  }
+
+  return $ret;
+}
+
Index: modules/book/book.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/book/book.info,v
retrieving revision 1.12
diff -u -p -r1.12 book.info
--- modules/book/book.info	8 Jun 2009 09:23:51 -0000	1.12
+++ modules/book/book.info	20 Jun 2009 19:43:58 -0000
@@ -10,3 +10,4 @@ files[] = book.admin.inc
 files[] = book.pages.inc
 files[] = book.install
 files[] = book.test
+files[] = book.update.inc
Index: modules/book/book.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/book/book.install,v
retrieving revision 1.30
diff -u -p -r1.30 book.install
--- modules/book/book.install	2 Jun 2009 06:58:15 -0000	1.30
+++ modules/book/book.install	20 Jun 2009 19:43:58 -0000
@@ -49,209 +49,6 @@ function _book_install_type_create() {
 }
 
 /**
- * Drupal 5.x to 6.x update.
- *
- * This function moves any existing book hierarchy into the new structure used
- * in the 6.x module. Rather than storing the hierarchy in the {book} table,
- * the menu API is used to store the hierarchy in the {menu_links} table and the
- * {book} table serves to uniquely connect a node to a menu link.
- *
- * In order to accomplish this, the current hierarchy is processed using a stack.
- * The stack insures that each parent is processed before any of its children
- * in the book hierarchy, and is compatible with batched update processing.
- *
- */
-function book_update_6000() {
-  $ret = array();
-
-  // Set up for a multi-part update.
-  if (!isset($_SESSION['book_update_6000'])) {
-
-    $schema['book'] = array(
-      'fields' => array(
-        'mlid'    => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
-        'nid'     => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
-        'bid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
-      ),
-      'primary key' => array('mlid'),
-      'unique keys' => array(
-        'nid' => array('nid'),
-      ),
-      'indexes' => array(
-        'bid' => array('bid'),
-      ),
-    );
-    // Add the node type.
-    _book_install_type_create();
-
-    // Fix role permissions to account for the changed names
-    // Setup the array holding strings to match and the corresponding
-    // strings to replace them with.
-    $replace = array(
-      'outline posts in books' => 'administer book outlines',
-      'create book pages' => 'create book content',
-      'edit book pages' => 'edit any book content',
-      'edit own book pages' => 'edit own book content',
-      'see printer-friendly version' => 'access printer-friendly version',
-    );
-
-    // Loop over all the roles, and do the necessary transformations.
-    $query = db_query("SELECT rid, perm FROM {permission} ORDER BY rid");
-    while ($role = db_fetch_object($query)) {
-      // Replace all the old permissions with the corresponding new permissions.
-      $fixed_perm = strtr($role->perm, $replace);
-      // If the user could previously create book pages, they should get the new
-      // 'add content to books' permission.
-      if (strpos($role->perm, 'create book pages') !== FALSE) {
-        $fixed_perm .= ', add content to books';
-      }
-      // Only save if the permissions have changed.
-      if ($fixed_perm != $role->perm) {
-        $ret[] = update_sql("UPDATE {permission} SET perm = '$fixed_perm' WHERE rid = $role->rid");
-      }
-    }
-
-    // Determine whether there are any existing nodes in the book hierarchy.
-    if (db_result(db_query("SELECT COUNT(*) FROM {book}"))) {
-      // Temporary table for the old book hierarchy; we'll discard revision info.
-      $schema['book_temp'] = array(
-        'fields' => array(
-          'nid'    => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
-          'parent' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
-          'weight' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny')
-        ),
-        'indexes' => array(
-          'parent' => array('parent')
-        ),
-        'primary key' => array('nid'),
-      );
-
-      db_create_table($ret, 'book_temp', $schema['book_temp']);
-
-      // Insert each node in the old table into the temporary table.
-      $ret[] = update_sql("INSERT INTO {book_temp} (nid, parent, weight) SELECT b.nid, b.parent, b.weight FROM {book} b INNER JOIN {node} n on b.vid = n.vid");
-      $ret[] = update_sql("DROP TABLE {book}");
-
-      db_create_table($ret, 'book', $schema['book']);
-
-      $_SESSION['book_update_6000_orphans'] = array('from' => 0);
-      $_SESSION['book_update_6000'] = array();
-      $result = db_query("SELECT * from {book_temp} WHERE parent = 0");
-
-      // Collect all books - top-level nodes.
-      while ($a = db_fetch_array($result)) {
-        $_SESSION['book_update_6000'][] = $a;
-      }
-      $ret['#finished'] = FALSE;
-      return $ret;
-    }
-    else {
-      // No existing nodes in the hierarchy, so drop the table and re-create it.
-      $ret[] = update_sql("DROP TABLE {book}");
-      db_create_table($ret, 'book', $schema['book']);
-      return $ret;
-    }
-  }
-  elseif (isset($_SESSION['book_update_6000_orphans'])) {
-    // Do the first batched part of the update - collect orphans.
-    $update_count = 400; // Update this many at a time.
-
-    $result = db_query_range("SELECT * FROM {book_temp}", $_SESSION['book_update_6000_orphans']['from'], $update_count);
-    $has_rows = FALSE;
-    // Go through the next $update_count book pages and locate the orphans.
-    while ($book = db_fetch_array($result)) {
-      $has_rows = TRUE;
-      // Orphans are defined as nodes whose parent does not exist in the table.
-      if ($book['parent'] && !db_result(db_query("SELECT COUNT(*) FROM {book_temp} WHERE nid = %d", $book['parent']))) {
-        if (empty($_SESSION['book_update_6000_orphans']['book'])) {
-          // The first orphan becomes the parent for all other orphans.
-          $book['parent'] = 0;
-          $_SESSION['book_update_6000_orphans']['book'] = $book;
-          $ret[] = array('success' => TRUE, 'query' => 'Relocated orphan book pages.');
-        }
-        else {
-          // Re-assign the parent value of the book, and add it to the stack.
-          $book['parent'] = $_SESSION['book_update_6000_orphans']['book']['nid'];
-          $_SESSION['book_update_6000'][] = $book;
-        }
-      }
-    }
-    if ($has_rows) {
-      $_SESSION['book_update_6000_orphans']['from'] += $update_count;
-    }
-    else {
-      if (!empty($_SESSION['book_update_6000_orphans']['book'])) {
-        // The orphans' parent is added last, so it will be processed first.
-        $_SESSION['book_update_6000'][] = $_SESSION['book_update_6000_orphans']['book'];
-      }
-      $_SESSION['book_update_6000_orphans'] = FALSE;
-    }
-    $ret['#finished'] = FALSE;
-
-    return $ret;
-  }
-  else {
-    // Run the next batched part of the update.
-    $update_count = 100; // Update this many at a time
-
-    while ($update_count && $_SESSION['book_update_6000']) {
-      // Get the last node off the stack.
-      $book = array_pop($_SESSION['book_update_6000']);
-
-      // Add all of this node's children to the stack.
-      $result = db_query("SELECT * FROM {book_temp} WHERE parent = %d", $book['nid']);
-      while ($a = db_fetch_array($result)) {
-        $_SESSION['book_update_6000'][] = $a;
-      }
-
-      if ($book['parent']) {
-        // If its not a top level page, get its parent's mlid.
-        $parent = db_fetch_array(db_query("SELECT b.mlid AS plid, b.bid FROM {book} b WHERE b.nid = %d", $book['parent']));
-        $book = array_merge($book, $parent);
-      }
-      else {
-        // There is no parent - this is a new book.
-        $book['plid'] = 0;
-        $book['bid'] = $book['nid'];
-      }
-
-      $book += array(
-        'module' => 'book',
-        'link_path' => 'node/' . $book['nid'],
-        'router_path' => 'node/%',
-        'menu_name' => 'book-toc-' . $book['bid'],
-      );
-      $book = array_merge($book, db_fetch_array(db_query("SELECT title AS link_title FROM {node} WHERE nid = %d", $book['nid'])));
-
-      // Items with depth > MENU_MAX_DEPTH cannot be saved.
-      if (menu_link_save($book)) {
-        db_query("INSERT INTO {book} (mlid, nid, bid) VALUES (%d, %d, %d)", $book['mlid'], $book['nid'], $book['bid']);
-      }
-      else {
-        // The depth was greater then MENU_MAX_DEPTH, so attach it to the
-        // closest valid parent.
-        $book['plid'] = db_result(db_query("SELECT plid FROM {menu_links} WHERE mlid = %d", $book['plid']));
-        if (menu_link_save($book)) {
-          db_query("INSERT INTO {book} (mlid, nid, bid) VALUES (%d, %d, %d)", $book['mlid'], $book['nid'], $book['bid']);
-        }
-      }
-      $update_count--;
-    }
-    $ret['#finished'] = FALSE;
-  }
-
-  if (empty($_SESSION['book_update_6000'])) {
-    $ret['#finished'] = TRUE;
-    $ret[] = array('success' => TRUE, 'query' => 'Relocated existing book pages.');
-    $ret[] = update_sql("DROP TABLE {book_temp}");
-    unset($_SESSION['book_update_6000']);
-    unset($_SESSION['book_update_6000_orphans']);
-  }
-
-  return $ret;
-}
-
-/**
  * Implement hook_schema().
  */
 function book_schema() {
Index: modules/book/book.update.inc
===================================================================
RCS file: modules/book/book.update.inc
diff -N modules/book/book.update.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/book/book.update.inc	20 Jun 2009 19:43:58 -0000
@@ -0,0 +1,211 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Update functions for Book module.
+ */
+
+/**
+ * Drupal 5.x to 6.x update.
+ *
+ * This function moves any existing book hierarchy into the new structure used
+ * in the 6.x module. Rather than storing the hierarchy in the {book} table,
+ * the menu API is used to store the hierarchy in the {menu_links} table and the
+ * {book} table serves to uniquely connect a node to a menu link.
+ *
+ * In order to accomplish this, the current hierarchy is processed using a stack.
+ * The stack insures that each parent is processed before any of its children
+ * in the book hierarchy, and is compatible with batched update processing.
+ *
+ */
+function book_update_6000() {
+  $ret = array();
+
+  // Set up for a multi-part update.
+  if (!isset($_SESSION['book_update_6000'])) {
+
+    $schema['book'] = array(
+      'fields' => array(
+        'mlid'    => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
+        'nid'     => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
+        'bid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
+      ),
+      'primary key' => array('mlid'),
+      'unique keys' => array(
+        'nid' => array('nid'),
+      ),
+      'indexes' => array(
+        'bid' => array('bid'),
+      ),
+    );
+    // Add the node type.
+    _book_install_type_create();
+
+    // Fix role permissions to account for the changed names
+    // Setup the array holding strings to match and the corresponding
+    // strings to replace them with.
+    $replace = array(
+      'outline posts in books' => 'administer book outlines',
+      'create book pages' => 'create book content',
+      'edit book pages' => 'edit any book content',
+      'edit own book pages' => 'edit own book content',
+      'see printer-friendly version' => 'access printer-friendly version',
+    );
+
+    // Loop over all the roles, and do the necessary transformations.
+    $query = db_query("SELECT rid, perm FROM {permission} ORDER BY rid");
+    while ($role = db_fetch_object($query)) {
+      // Replace all the old permissions with the corresponding new permissions.
+      $fixed_perm = strtr($role->perm, $replace);
+      // If the user could previously create book pages, they should get the new
+      // 'add content to books' permission.
+      if (strpos($role->perm, 'create book pages') !== FALSE) {
+        $fixed_perm .= ', add content to books';
+      }
+      // Only save if the permissions have changed.
+      if ($fixed_perm != $role->perm) {
+        $ret[] = update_sql("UPDATE {permission} SET perm = '$fixed_perm' WHERE rid = $role->rid");
+      }
+    }
+
+    // Determine whether there are any existing nodes in the book hierarchy.
+    if (db_result(db_query("SELECT COUNT(*) FROM {book}"))) {
+      // Temporary table for the old book hierarchy; we'll discard revision info.
+      $schema['book_temp'] = array(
+        'fields' => array(
+          'nid'    => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
+          'parent' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
+          'weight' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny')
+        ),
+        'indexes' => array(
+          'parent' => array('parent')
+        ),
+        'primary key' => array('nid'),
+      );
+
+      db_create_table($ret, 'book_temp', $schema['book_temp']);
+
+      // Insert each node in the old table into the temporary table.
+      $ret[] = update_sql("INSERT INTO {book_temp} (nid, parent, weight) SELECT b.nid, b.parent, b.weight FROM {book} b INNER JOIN {node} n on b.vid = n.vid");
+      $ret[] = update_sql("DROP TABLE {book}");
+
+      db_create_table($ret, 'book', $schema['book']);
+
+      $_SESSION['book_update_6000_orphans'] = array('from' => 0);
+      $_SESSION['book_update_6000'] = array();
+      $result = db_query("SELECT * from {book_temp} WHERE parent = 0");
+
+      // Collect all books - top-level nodes.
+      while ($a = db_fetch_array($result)) {
+        $_SESSION['book_update_6000'][] = $a;
+      }
+      $ret['#finished'] = FALSE;
+      return $ret;
+    }
+    else {
+      // No existing nodes in the hierarchy, so drop the table and re-create it.
+      $ret[] = update_sql("DROP TABLE {book}");
+      db_create_table($ret, 'book', $schema['book']);
+      return $ret;
+    }
+  }
+  elseif (isset($_SESSION['book_update_6000_orphans'])) {
+    // Do the first batched part of the update - collect orphans.
+    $update_count = 400; // Update this many at a time.
+
+    $result = db_query_range("SELECT * FROM {book_temp}", $_SESSION['book_update_6000_orphans']['from'], $update_count);
+    $has_rows = FALSE;
+    // Go through the next $update_count book pages and locate the orphans.
+    while ($book = db_fetch_array($result)) {
+      $has_rows = TRUE;
+      // Orphans are defined as nodes whose parent does not exist in the table.
+      if ($book['parent'] && !db_result(db_query("SELECT COUNT(*) FROM {book_temp} WHERE nid = %d", $book['parent']))) {
+        if (empty($_SESSION['book_update_6000_orphans']['book'])) {
+          // The first orphan becomes the parent for all other orphans.
+          $book['parent'] = 0;
+          $_SESSION['book_update_6000_orphans']['book'] = $book;
+          $ret[] = array('success' => TRUE, 'query' => 'Relocated orphan book pages.');
+        }
+        else {
+          // Re-assign the parent value of the book, and add it to the stack.
+          $book['parent'] = $_SESSION['book_update_6000_orphans']['book']['nid'];
+          $_SESSION['book_update_6000'][] = $book;
+        }
+      }
+    }
+    if ($has_rows) {
+      $_SESSION['book_update_6000_orphans']['from'] += $update_count;
+    }
+    else {
+      if (!empty($_SESSION['book_update_6000_orphans']['book'])) {
+        // The orphans' parent is added last, so it will be processed first.
+        $_SESSION['book_update_6000'][] = $_SESSION['book_update_6000_orphans']['book'];
+      }
+      $_SESSION['book_update_6000_orphans'] = FALSE;
+    }
+    $ret['#finished'] = FALSE;
+
+    return $ret;
+  }
+  else {
+    // Run the next batched part of the update.
+    $update_count = 100; // Update this many at a time
+
+    while ($update_count && $_SESSION['book_update_6000']) {
+      // Get the last node off the stack.
+      $book = array_pop($_SESSION['book_update_6000']);
+
+      // Add all of this node's children to the stack.
+      $result = db_query("SELECT * FROM {book_temp} WHERE parent = %d", $book['nid']);
+      while ($a = db_fetch_array($result)) {
+        $_SESSION['book_update_6000'][] = $a;
+      }
+
+      if ($book['parent']) {
+        // If its not a top level page, get its parent's mlid.
+        $parent = db_fetch_array(db_query("SELECT b.mlid AS plid, b.bid FROM {book} b WHERE b.nid = %d", $book['parent']));
+        $book = array_merge($book, $parent);
+      }
+      else {
+        // There is no parent - this is a new book.
+        $book['plid'] = 0;
+        $book['bid'] = $book['nid'];
+      }
+
+      $book += array(
+        'module' => 'book',
+        'link_path' => 'node/' . $book['nid'],
+        'router_path' => 'node/%',
+        'menu_name' => 'book-toc-' . $book['bid'],
+      );
+      $book = array_merge($book, db_fetch_array(db_query("SELECT title AS link_title FROM {node} WHERE nid = %d", $book['nid'])));
+
+      // Items with depth > MENU_MAX_DEPTH cannot be saved.
+      if (menu_link_save($book)) {
+        db_query("INSERT INTO {book} (mlid, nid, bid) VALUES (%d, %d, %d)", $book['mlid'], $book['nid'], $book['bid']);
+      }
+      else {
+        // The depth was greater then MENU_MAX_DEPTH, so attach it to the
+        // closest valid parent.
+        $book['plid'] = db_result(db_query("SELECT plid FROM {menu_links} WHERE mlid = %d", $book['plid']));
+        if (menu_link_save($book)) {
+          db_query("INSERT INTO {book} (mlid, nid, bid) VALUES (%d, %d, %d)", $book['mlid'], $book['nid'], $book['bid']);
+        }
+      }
+      $update_count--;
+    }
+    $ret['#finished'] = FALSE;
+  }
+
+  if (empty($_SESSION['book_update_6000'])) {
+    $ret['#finished'] = TRUE;
+    $ret[] = array('success' => TRUE, 'query' => 'Relocated existing book pages.');
+    $ret[] = update_sql("DROP TABLE {book_temp}");
+    unset($_SESSION['book_update_6000']);
+    unset($_SESSION['book_update_6000_orphans']);
+  }
+
+  return $ret;
+}
+
Index: modules/comment/comment.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.info,v
retrieving revision 1.10
diff -u -p -r1.10 comment.info
--- modules/comment/comment.info	8 Jun 2009 09:23:51 -0000	1.10
+++ modules/comment/comment.info	20 Jun 2009 19:43:58 -0000
@@ -10,3 +10,4 @@ files[] = comment.admin.inc
 files[] = comment.pages.inc
 files[] = comment.install
 files[] = comment.test
+files[] = comment.update.inc
Index: modules/comment/comment.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.install,v
retrieving revision 1.38
diff -u -p -r1.38 comment.install
--- modules/comment/comment.install	16 Jun 2009 20:50:26 -0000	1.38
+++ modules/comment/comment.install	20 Jun 2009 19:43:58 -0000
@@ -46,72 +46,6 @@ function comment_enable() {
 }
 
 /**
- * Changed node_comment_statistics to use node->changed to avoid future timestamps.
- */
-function comment_update_1() {
-  // Change any future last comment timestamps to current time.
-  db_query('UPDATE {node_comment_statistics} SET last_comment_timestamp = %d WHERE last_comment_timestamp > %d', REQUEST_TIME, REQUEST_TIME);
-
-  // Unstuck node indexing timestamp if needed.
-  if (($last = variable_get('node_cron_last', FALSE)) !== FALSE) {
-    variable_set('node_cron_last', min(REQUEST_TIME, $last));
-  }
-
-  return array();
-}
-
-/**
- * @defgroup updates-5.x-to-6.x Comment updates from 5.x to 6.x
- * @{
- */
-
-function comment_update_6001() {
-  $ret[] = update_sql("ALTER TABLE {comments} DROP score");
-  $ret[] = update_sql("ALTER TABLE {comments} DROP users");
-
-  return $ret;
-}
-
-/**
- * Changed comment settings from global to per-node -- copy global
- * settings to all node types.
- */
-function comment_update_6002() {
-  // Comment module might not be enabled when this is run, but we need the
-  // constants defined by the module for this update.
-  drupal_load('module', 'comment');
-  $settings = array(
-    'comment_default_mode' => COMMENT_MODE_THREADED_EXPANDED,
-    'comment_default_order' => COMMENT_ORDER_NEWEST_FIRST,
-    'comment_default_per_page' => 50,
-    'comment_controls' => COMMENT_CONTROLS_HIDDEN,
-    'comment_anonymous' => COMMENT_ANONYMOUS_MAYNOT_CONTACT,
-    'comment_subject_field' => 1,
-    'comment_preview' => COMMENT_PREVIEW_REQUIRED,
-    'comment_form_location' => COMMENT_FORM_SEPARATE_PAGE,
-  );
-  $types = node_type_get_types();
-  foreach ($settings as $setting => $default) {
-    $value = variable_get($setting, $default);
-    foreach ($types as $type => $object) {
-      variable_set($setting . '_' . $type, $value);
-    }
-    variable_del($setting);
-  }
-  return array(array('success' => TRUE, 'query' => 'Global comment settings copied to all node types.'));
-}
-
-/**
- * Add index to parent ID field.
- */
-function comment_update_6003() {
-  $ret = array();
-  db_add_index($ret, 'comments', 'pid', array('pid'));
-
-  return $ret;
-}
-
-/**
  * @} End of "defgroup updates-5.x-to-6.x"
  * The next series of updates should start at 7000.
  */
@@ -122,50 +56,6 @@ function comment_update_6003() {
  */
 
 /**
- * Remove comment settings for page ordering.
- */
-function comment_update_7000() {
-  $types = node_type_get_types();
-  foreach ($types as $type => $object) {
-    variable_del('comment_default_order' . $type);
-  }
-  return array(array('success' => TRUE, 'query' => 'Comment order settings removed.'));
-}
-
-/**
- * Change comment status from published being 0 to being 1
- */
-function comment_update_7001() {
-  $ret = array();
-  $ret[] = update_sql("UPDATE {comments} SET status = 3 WHERE status = 0");
-  $ret[] = update_sql("UPDATE {comments} SET status = 0 WHERE status = 1");
-  $ret[] = update_sql("UPDATE {comments} SET status = 1 WHERE status = 3");
-
-  return $ret;
-}
-
-/**
- * Rename {comments} table to {comment}.
- */
-function comment_update_7002() {
-  $ret = array();
-  db_rename_table($ret, 'comments', 'comment');
-  return $ret;
-}
-
-/**
- * Improve indexes on the comment table.
- */
-function comment_update_7003() {
-  $ret = array();
-  db_drop_index($ret, 'comment', 'status');
-  db_drop_index($ret, 'comment', 'pid');
-  db_add_index($ret, 'comment', 'comment_pid_status', array('pid', 'status'));
-  db_add_index($ret, 'comment', 'comment_num_new', array('nid', 'timestamp', 'status'));
-  return $ret;
-}
-
-/**
  * @} End of "defgroup updates-6.x-to-7.x"
  * The next series of updates should start at 8000.
  */
Index: modules/comment/comment.update.inc
===================================================================
RCS file: modules/comment/comment.update.inc
diff -N modules/comment/comment.update.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/comment/comment.update.inc	20 Jun 2009 19:43:58 -0000
@@ -0,0 +1,118 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Update functions for Comment module.
+ */
+
+/**
+ * Changed node_comment_statistics to use node->changed to avoid future timestamps.
+ */
+function comment_update_1() {
+  // Change any future last comment timestamps to current time.
+  db_query('UPDATE {node_comment_statistics} SET last_comment_timestamp = %d WHERE last_comment_timestamp > %d', REQUEST_TIME, REQUEST_TIME);
+
+  // Unstuck node indexing timestamp if needed.
+  if (($last = variable_get('node_cron_last', FALSE)) !== FALSE) {
+    variable_set('node_cron_last', min(REQUEST_TIME, $last));
+  }
+
+  return array();
+}
+
+/**
+ * @defgroup updates-5.x-to-6.x Comment updates from 5.x to 6.x
+ * @{
+ */
+
+function comment_update_6001() {
+  $ret[] = update_sql("ALTER TABLE {comments} DROP score");
+  $ret[] = update_sql("ALTER TABLE {comments} DROP users");
+
+  return $ret;
+}
+
+/**
+ * Changed comment settings from global to per-node -- copy global
+ * settings to all node types.
+ */
+function comment_update_6002() {
+  // Comment module might not be enabled when this is run, but we need the
+  // constants defined by the module for this update.
+  drupal_load('module', 'comment');
+  $settings = array(
+    'comment_default_mode' => COMMENT_MODE_THREADED_EXPANDED,
+    'comment_default_order' => COMMENT_ORDER_NEWEST_FIRST,
+    'comment_default_per_page' => 50,
+    'comment_controls' => COMMENT_CONTROLS_HIDDEN,
+    'comment_anonymous' => COMMENT_ANONYMOUS_MAYNOT_CONTACT,
+    'comment_subject_field' => 1,
+    'comment_preview' => COMMENT_PREVIEW_REQUIRED,
+    'comment_form_location' => COMMENT_FORM_SEPARATE_PAGE,
+  );
+  $types = node_type_get_types();
+  foreach ($settings as $setting => $default) {
+    $value = variable_get($setting, $default);
+    foreach ($types as $type => $object) {
+      variable_set($setting . '_' . $type, $value);
+    }
+    variable_del($setting);
+  }
+  return array(array('success' => TRUE, 'query' => 'Global comment settings copied to all node types.'));
+}
+
+/**
+ * Add index to parent ID field.
+ */
+function comment_update_6003() {
+  $ret = array();
+  db_add_index($ret, 'comments', 'pid', array('pid'));
+
+  return $ret;
+}
+
+/**
+ * Remove comment settings for page ordering.
+ */
+function comment_update_7000() {
+  $types = node_type_get_types();
+  foreach ($types as $type => $object) {
+    variable_del('comment_default_order' . $type);
+  }
+  return array(array('success' => TRUE, 'query' => 'Comment order settings removed.'));
+}
+
+/**
+ * Change comment status from published being 0 to being 1
+ */
+function comment_update_7001() {
+  $ret = array();
+  $ret[] = update_sql("UPDATE {comments} SET status = 3 WHERE status = 0");
+  $ret[] = update_sql("UPDATE {comments} SET status = 0 WHERE status = 1");
+  $ret[] = update_sql("UPDATE {comments} SET status = 1 WHERE status = 3");
+
+  return $ret;
+}
+
+/**
+ * Rename {comments} table to {comment}.
+ */
+function comment_update_7002() {
+  $ret = array();
+  db_rename_table($ret, 'comments', 'comment');
+  return $ret;
+}
+
+/**
+ * Improve indexes on the comment table.
+ */
+function comment_update_7003() {
+  $ret = array();
+  db_drop_index($ret, 'comment', 'status');
+  db_drop_index($ret, 'comment', 'pid');
+  db_add_index($ret, 'comment', 'comment_pid_status', array('pid', 'status'));
+  db_add_index($ret, 'comment', 'comment_num_new', array('nid', 'timestamp', 'status'));
+  return $ret;
+}
+
Index: modules/dblog/dblog.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/dblog/dblog.info,v
retrieving revision 1.7
diff -u -p -r1.7 dblog.info
--- modules/dblog/dblog.info	8 Jun 2009 09:23:51 -0000	1.7
+++ modules/dblog/dblog.info	20 Jun 2009 19:43:58 -0000
@@ -8,3 +8,4 @@ files[] = dblog.module
 files[] = dblog.admin.inc
 files[] = dblog.install
 files[] = dblog.test
+files[] = dblog.update.inc
Index: modules/dblog/dblog.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/dblog/dblog.install,v
retrieving revision 1.16
diff -u -p -r1.16 dblog.install
--- modules/dblog/dblog.install	27 May 2009 18:33:56 -0000	1.16
+++ modules/dblog/dblog.install	20 Jun 2009 19:43:58 -0000
@@ -108,30 +108,3 @@ function dblog_schema() {
   return $schema;
 }
 
-/**
- * Allow NULL values for links and longer referers.
- */
-function dblog_update_7001() {
-  $ret = array();
-  db_change_field($ret, 'watchdog', 'link', 'link', array('type' => 'varchar', 'length' => 255, 'not null' => FALSE, 'default' => ''));
-  db_change_field($ret, 'watchdog', 'referer', 'referer', array('type' => 'text', 'not null' => FALSE));
-  return $ret;
-}
-
-/**
- * Add index on uid.
- */
-function dblog_update_7002() {
-  $ret = array();
-  db_add_index($ret, 'watchdog', 'uid', array('uid'));
-  return $ret;
-}
-
-/**
- * Allow longer type values.
- */
-function dblog_update_7003() {
-  $ret = array();
-  db_change_field($ret, 'watchdog', 'type', 'type', array('type' => 'varchar', 'length' => 64, 'not null' => TRUE, 'default' => ''));
-  return $ret;
-}
Index: modules/dblog/dblog.update.inc
===================================================================
RCS file: modules/dblog/dblog.update.inc
diff -N modules/dblog/dblog.update.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/dblog/dblog.update.inc	20 Jun 2009 19:43:58 -0000
@@ -0,0 +1,35 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Update functions for Dblog module.
+ */
+
+/**
+ * Allow NULL values for links and longer referers.
+ */
+function dblog_update_7001() {
+  $ret = array();
+  db_change_field($ret, 'watchdog', 'link', 'link', array('type' => 'varchar', 'length' => 255, 'not null' => FALSE, 'default' => ''));
+  db_change_field($ret, 'watchdog', 'referer', 'referer', array('type' => 'text', 'not null' => FALSE));
+  return $ret;
+}
+
+/**
+ * Add index on uid.
+ */
+function dblog_update_7002() {
+  $ret = array();
+  db_add_index($ret, 'watchdog', 'uid', array('uid'));
+  return $ret;
+}
+
+/**
+ * Allow longer type values.
+ */
+function dblog_update_7003() {
+  $ret = array();
+  db_change_field($ret, 'watchdog', 'type', 'type', array('type' => 'varchar', 'length' => 64, 'not null' => TRUE, 'default' => ''));
+  return $ret;
+}
Index: modules/filter/filter.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.info,v
retrieving revision 1.12
diff -u -p -r1.12 filter.info
--- modules/filter/filter.info	8 Jun 2009 09:23:52 -0000	1.12
+++ modules/filter/filter.info	20 Jun 2009 19:43:58 -0000
@@ -10,3 +10,4 @@ files[] = filter.pages.inc
 files[] = filter.install
 files[] = filter.test
 required = TRUE
+files[] = filter.update.inc
Index: modules/filter/filter.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.install,v
retrieving revision 1.16
diff -u -p -r1.16 filter.install
--- modules/filter/filter.install	27 May 2009 18:33:57 -0000	1.16
+++ modules/filter/filter.install	20 Jun 2009 19:43:58 -0000
@@ -103,37 +103,3 @@ function filter_schema() {
   return $schema;
 }
 
-/**
- * Add a weight column to the filter formats table.
- */
-function filter_update_7000() {
-  $ret = array();
-  db_add_field($ret, 'filter_formats', 'weight', array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny'));
-  return $ret;
-}
-
-/**
- * Break out "escape HTML filter" option to its own filter.
- */
-function filter_update_7001() {
-  $ret = array();
-  $result = db_query("SELECT format FROM {filter_formats}");
-  foreach ($result as $format) {
-    // Deprecated constants FILTER_HTML_STRIP = 1 and FILTER_HTML_ESCAPE = 2.
-    if (variable_get('filter_html_' . $format->format, 1) == 2) {
-      $ret[] = update_sql("INSERT INTO {filters} (format, module, delta, weight) VALUES (" . $format->format . ", 'filter', 4, 0)");
-    }
-    variable_del('filter_html_' . $format->format);
-  }
-  return $ret;
-}
-
-/**
- * Rename {filters} table to {filter} and {filter_formats} table to {filter_format}.
- */
-function filter_update_7002() {
-  $ret = array();
-  db_rename_table($ret, 'filters', 'filter');
-  db_rename_table($ret, 'filter_formats', 'filter_format');
-  return $ret;
-}
Index: modules/filter/filter.update.inc
===================================================================
RCS file: modules/filter/filter.update.inc
diff -N modules/filter/filter.update.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/filter/filter.update.inc	20 Jun 2009 19:43:58 -0000
@@ -0,0 +1,42 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Update functions for Filter module.
+ */
+
+/**
+ * Add a weight column to the filter formats table.
+ */
+function filter_update_7000() {
+  $ret = array();
+  db_add_field($ret, 'filter_formats', 'weight', array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny'));
+  return $ret;
+}
+
+/**
+ * Break out "escape HTML filter" option to its own filter.
+ */
+function filter_update_7001() {
+  $ret = array();
+  $result = db_query("SELECT format FROM {filter_formats}");
+  foreach ($result as $format) {
+    // Deprecated constants FILTER_HTML_STRIP = 1 and FILTER_HTML_ESCAPE = 2.
+    if (variable_get('filter_html_' . $format->format, 1) == 2) {
+      $ret[] = update_sql("INSERT INTO {filters} (format, module, delta, weight) VALUES (" . $format->format . ", 'filter', 4, 0)");
+    }
+    variable_del('filter_html_' . $format->format);
+  }
+  return $ret;
+}
+
+/**
+ * Rename {filters} table to {filter} and {filter_formats} table to {filter_format}.
+ */
+function filter_update_7002() {
+  $ret = array();
+  db_rename_table($ret, 'filters', 'filter');
+  db_rename_table($ret, 'filter_formats', 'filter_format');
+  return $ret;
+}
Index: modules/forum/forum.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum/forum.info,v
retrieving revision 1.12
diff -u -p -r1.12 forum.info
--- modules/forum/forum.info	8 Jun 2009 09:23:52 -0000	1.12
+++ modules/forum/forum.info	20 Jun 2009 19:43:58 -0000
@@ -11,3 +11,4 @@ files[] = forum.admin.inc
 files[] = forum.pages.inc
 files[] = forum.install
 files[] = forum.test
+files[] = forum.update.inc
Index: modules/forum/forum.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum/forum.install,v
retrieving revision 1.30
diff -u -p -r1.30 forum.install
--- modules/forum/forum.install	19 Jun 2009 06:28:44 -0000	1.30
+++ modules/forum/forum.install	20 Jun 2009 19:43:58 -0000
@@ -111,32 +111,3 @@ function forum_schema() {
   return $schema;
 }
 
-/**
- * Create the forum vocabulary if does not exist. Assign the
- * vocabulary a low weight so it will appear first in forum topic
- * create and edit forms. Do not just call forum_enable() because in
- * future versions it might do something different.
- */
-function forum_update_6000() {
-  $ret = array();
-
-  $vid = variable_get('forum_nav_vocabulary', 0);
-  $vocabularies = taxonomy_get_vocabularies();
-  if (!isset($vocabularies[$vid])) {
-    $vocabulary = array(
-      'name' => t('Forums'),
-      'multiple' => 0,
-      'required' => 0,
-      'hierarchy' => 1,
-      'relations' => 0,
-      'module' => 'forum',
-      'weight' => -10,
-      'nodes' => array('forum' => 1),
-    );
-    taxonomy_save_vocabulary($vocabulary);
-
-    variable_set('forum_nav_vocabulary', $vocabulary['vid']);
-  }
-
-  return $ret;
-}
Index: modules/forum/forum.update.inc
===================================================================
RCS file: modules/forum/forum.update.inc
diff -N modules/forum/forum.update.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/forum/forum.update.inc	20 Jun 2009 19:43:58 -0000
@@ -0,0 +1,37 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Update functions for Forum module.
+ */
+
+/**
+ * Create the forum vocabulary if does not exist. Assign the
+ * vocabulary a low weight so it will appear first in forum topic
+ * create and edit forms. Do not just call forum_enable() because in
+ * future versions it might do something different.
+ */
+function forum_update_6000() {
+  $ret = array();
+
+  $vid = variable_get('forum_nav_vocabulary', 0);
+  $vocabularies = taxonomy_get_vocabularies();
+  if (!isset($vocabularies[$vid])) {
+    $vocabulary = array(
+      'name' => t('Forums'),
+      'multiple' => 0,
+      'required' => 0,
+      'hierarchy' => 1,
+      'relations' => 0,
+      'module' => 'forum',
+      'weight' => -10,
+      'nodes' => array('forum' => 1),
+    );
+    taxonomy_save_vocabulary($vocabulary);
+
+    variable_set('forum_nav_vocabulary', $vocabulary['vid']);
+  }
+
+  return $ret;
+}
Index: modules/locale/locale.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/locale/locale.info,v
retrieving revision 1.11
diff -u -p -r1.11 locale.info
--- modules/locale/locale.info	8 Jun 2009 09:23:52 -0000	1.11
+++ modules/locale/locale.info	20 Jun 2009 19:43:58 -0000
@@ -7,3 +7,4 @@ core = 7.x
 files[] = locale.module
 files[] = locale.install
 files[] = locale.test
+files[] = locale.update.inc
Index: modules/locale/locale.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/locale/locale.install,v
retrieving revision 1.44
diff -u -p -r1.44 locale.install
--- modules/locale/locale.install	8 Jun 2009 05:00:11 -0000	1.44
+++ modules/locale/locale.install	20 Jun 2009 19:43:58 -0000
@@ -36,196 +36,6 @@ function locale_install() {
  */
 
 /**
- * {locales_meta} table became {languages}.
- */
-function locale_update_6000() {
-  $ret = array();
-
-  $schema['languages'] = array(
-    'fields' => array(
-      'language' => array(
-        'type' => 'varchar',
-        'length' => 12,
-        'not null' => TRUE,
-        'default' => '',
-      ),
-      'name' => array(
-        'type' => 'varchar',
-        'length' => 64,
-        'not null' => TRUE,
-        'default' => '',
-      ),
-      'native' => array(
-        'type' => 'varchar',
-        'length' => 64,
-        'not null' => TRUE,
-        'default' => '',
-      ),
-      'direction' => array(
-        'type' => 'int',
-        'not null' => TRUE,
-        'default' => 0,
-      ),
-      'enabled' => array(
-        'type' => 'int',
-        'not null' => TRUE,
-        'default' => 0,
-      ),
-      'plurals' => array(
-        'type' => 'int',
-        'not null' => TRUE,
-        'default' => 0,
-      ),
-      'formula' => array(
-        'type' => 'varchar',
-        'length' => 128,
-        'not null' => TRUE,
-        'default' => '',
-      ),
-      'domain' => array(
-        'type' => 'varchar',
-        'length' => 128,
-        'not null' => TRUE,
-        'default' => '',
-      ),
-      'prefix' => array(
-        'type' => 'varchar',
-        'length' => 128,
-        'not null' => TRUE,
-        'default' => '',
-      ),
-      'weight' => array(
-        'type' => 'int',
-        'not null' => TRUE,
-        'default' => 0,
-      ),
-      'javascript' => array( //Adds a column to store the filename of the JavaScript translation file.
-        'type' => 'varchar',
-        'length' => 32,
-        'not null' => TRUE,
-        'default' => '',
-      ),
-    ),
-    'primary key' => array('language'),
-    'indexes' => array(
-      'list' => array('weight', 'name'),
-    ),
-  );
-
-  db_create_table($ret, 'languages', $schema['languages']);
-
-  // Save the languages
-  $ret[] = update_sql("INSERT INTO {languages} (language, name, native, direction, enabled, plurals, formula, domain, prefix, weight) SELECT locale, name, name, 0, enabled, plurals, formula, '', locale, 0 FROM {locales_meta}");
-
-  // Save the language count in the variable table
-  $count = db_result(db_query('SELECT COUNT(*) FROM {languages} WHERE enabled = 1'));
-  variable_set('language_count', $count);
-
-  // Save the default language in the variable table
-  $default = db_fetch_object(db_query('SELECT * FROM {locales_meta} WHERE isdefault = 1'));
-  variable_set('language_default', (object) array('language' => $default->locale, 'name' => $default->name, 'native' => '', 'direction' => 0, 'enabled' => 1, 'plurals' => $default->plurals, 'formula' => $default->formula, 'domain' => '', 'prefix' => $default->locale, 'weight' => 0));
-
-  $ret[] = update_sql("DROP TABLE {locales_meta}");
-  return $ret;
-}
-
-/**
- * Change locale column to language. The language column is added by
- * update_fix_d6_requirements() in update.php to avoid a large number
- * of error messages from update.php. All we need to do here is copy
- * locale to language and then drop locale.
- */
-function locale_update_6001() {
-  $ret = array();
-  $ret[] = update_sql('UPDATE {locales_target} SET language = locale');
-  db_drop_field($ret, 'locales_target', 'locale');
-  return $ret;
-}
-
-/**
- * Remove empty translations, we don't need these anymore.
- */
-function locale_update_6002() {
-  $ret = array();
-  $ret[] = update_sql("DELETE FROM {locales_target} WHERE translation = ''");
-  return $ret;
-}
-
-/**
- * Prune strings with no translations (will be automatically re-registered if still in use)
- */
-function locale_update_6003() {
-  $ret = array();
-  $ret[] = update_sql("DELETE FROM {locales_source} WHERE lid NOT IN (SELECT lid FROM {locales_target})");
-  return $ret;
-}
-
-/**
- * Fix remaining inconsistent indexes.
- */
-function locale_update_6004() {
-  $ret = array();
-  db_add_index($ret, 'locales_target', 'language', array('language'));
-
-  switch ($GLOBALS['db_type']) {
-    case 'pgsql':
-      db_drop_index($ret, 'locales_source', 'source');
-      db_add_index($ret, 'locales_source', 'source', array(array('source', 30)));
-      break;
-  }
-
-  return $ret;
-}
-
-/**
- * Change language setting variable of content types.
- *
- * Use language_content_type_<content_type> instead of language_<content_type>
- * so content types such as 'default', 'count' or 'negotiation' will not
- * interfere with language variables.
- */
-function locale_update_6005() {
-  foreach (node_type_get_types() as $type => $content_type) {
-    // Default to NULL, so we can skip dealing with non-existent settings.
-    $setting = variable_get('language_' . $type);
-    if ($type == 'default' && is_numeric($setting)) {
-      // language_default was overwritten with the content type setting,
-      // so reset the default language and save the content type setting.
-      variable_set('language_content_type_default', $setting);
-      variable_del('language_default');
-      drupal_set_message('The default language setting has been reset to its default value. Check the ' . l('language configuration page', 'admin/settings/language') . ' to configure it correctly.');
-    }
-    elseif ($type == 'negotiation') {
-      // language_content_type_negotiation is an integer either if it is
-      // the negotiation setting or the content type setting.
-      // The language_negotiation setting is not reset, but
-      // the user is alerted that this setting possibly was overwritten
-      variable_set('language_content_type_negotiation', $setting);
-      drupal_set_message('The language negotiation setting was possibly overwritten by a content type of the same name. Check the ' . l('language configuration page', 'admin/settings/language/configure') . ' and the ' . l('<em>' . $content_type->name . "</em> content type's multilingual support settings", 'admin/build/types/negotiation', array('html' => TRUE)) . ' to configure them correctly.');
-    }
-    elseif (!is_null($setting)) {
-      // Change the language setting variable for any other content type.
-      // Do not worry about language_count, it will be updated below.
-      variable_set('language_content_type_' . $type, $setting);
-      variable_del('language_' . $type);
-    }
-  }
-  // Update language count variable that might be overwritten.
-  $count = db_result(db_query('SELECT COUNT(*) FROM {languages} WHERE enabled = 1'));
-  variable_set('language_count', $count);
-  return array();
-}
-
-/**
- * Allow longer location.
- */
-function locale_update_6006() {
-  $ret = array();
-  db_change_field($ret, 'locales_source', 'location', 'location', array('type' => 'text', 'not null' => FALSE));
-  return $ret;
-}
-
-/**
  * @} End of "defgroup updates-5.x-to-6.x"
  */
 
@@ -235,16 +45,6 @@ function locale_update_6006() {
  */
 
 /**
- * Allow longer location.
- */
-function locale_update_7000() {
-  $ret = array();
-  db_drop_index($ret, 'locales_source', 'source');
-  db_add_index($ret, 'locales_source', 'source_context', array(array('source', 30), 'context'));
-  return $ret;
-}
-
-/**
  * @} End of "defgroup updates-6.x-to-7.x"
  */
 
Index: modules/locale/locale.update.inc
===================================================================
RCS file: modules/locale/locale.update.inc
diff -N modules/locale/locale.update.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/locale/locale.update.inc	20 Jun 2009 19:43:58 -0000
@@ -0,0 +1,208 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Update functions for Locale module.
+ */
+
+/**
+ * {locales_meta} table became {languages}.
+ */
+function locale_update_6000() {
+  $ret = array();
+
+  $schema['languages'] = array(
+    'fields' => array(
+      'language' => array(
+        'type' => 'varchar',
+        'length' => 12,
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'name' => array(
+        'type' => 'varchar',
+        'length' => 64,
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'native' => array(
+        'type' => 'varchar',
+        'length' => 64,
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'direction' => array(
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'enabled' => array(
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'plurals' => array(
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'formula' => array(
+        'type' => 'varchar',
+        'length' => 128,
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'domain' => array(
+        'type' => 'varchar',
+        'length' => 128,
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'prefix' => array(
+        'type' => 'varchar',
+        'length' => 128,
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'weight' => array(
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'javascript' => array( //Adds a column to store the filename of the JavaScript translation file.
+        'type' => 'varchar',
+        'length' => 32,
+        'not null' => TRUE,
+        'default' => '',
+      ),
+    ),
+    'primary key' => array('language'),
+    'indexes' => array(
+      'list' => array('weight', 'name'),
+    ),
+  );
+
+  db_create_table($ret, 'languages', $schema['languages']);
+
+  // Save the languages
+  $ret[] = update_sql("INSERT INTO {languages} (language, name, native, direction, enabled, plurals, formula, domain, prefix, weight) SELECT locale, name, name, 0, enabled, plurals, formula, '', locale, 0 FROM {locales_meta}");
+
+  // Save the language count in the variable table
+  $count = db_result(db_query('SELECT COUNT(*) FROM {languages} WHERE enabled = 1'));
+  variable_set('language_count', $count);
+
+  // Save the default language in the variable table
+  $default = db_fetch_object(db_query('SELECT * FROM {locales_meta} WHERE isdefault = 1'));
+  variable_set('language_default', (object) array('language' => $default->locale, 'name' => $default->name, 'native' => '', 'direction' => 0, 'enabled' => 1, 'plurals' => $default->plurals, 'formula' => $default->formula, 'domain' => '', 'prefix' => $default->locale, 'weight' => 0));
+
+  $ret[] = update_sql("DROP TABLE {locales_meta}");
+  return $ret;
+}
+
+/**
+ * Change locale column to language. The language column is added by
+ * update_fix_d6_requirements() in update.php to avoid a large number
+ * of error messages from update.php. All we need to do here is copy
+ * locale to language and then drop locale.
+ */
+function locale_update_6001() {
+  $ret = array();
+  $ret[] = update_sql('UPDATE {locales_target} SET language = locale');
+  db_drop_field($ret, 'locales_target', 'locale');
+  return $ret;
+}
+
+/**
+ * Remove empty translations, we don't need these anymore.
+ */
+function locale_update_6002() {
+  $ret = array();
+  $ret[] = update_sql("DELETE FROM {locales_target} WHERE translation = ''");
+  return $ret;
+}
+
+/**
+ * Prune strings with no translations (will be automatically re-registered if still in use)
+ */
+function locale_update_6003() {
+  $ret = array();
+  $ret[] = update_sql("DELETE FROM {locales_source} WHERE lid NOT IN (SELECT lid FROM {locales_target})");
+  return $ret;
+}
+
+/**
+ * Fix remaining inconsistent indexes.
+ */
+function locale_update_6004() {
+  $ret = array();
+  db_add_index($ret, 'locales_target', 'language', array('language'));
+
+  switch ($GLOBALS['db_type']) {
+    case 'pgsql':
+      db_drop_index($ret, 'locales_source', 'source');
+      db_add_index($ret, 'locales_source', 'source', array(array('source', 30)));
+      break;
+  }
+
+  return $ret;
+}
+
+/**
+ * Change language setting variable of content types.
+ *
+ * Use language_content_type_<content_type> instead of language_<content_type>
+ * so content types such as 'default', 'count' or 'negotiation' will not
+ * interfere with language variables.
+ */
+function locale_update_6005() {
+  foreach (node_type_get_types() as $type => $content_type) {
+    // Default to NULL, so we can skip dealing with non-existent settings.
+    $setting = variable_get('language_' . $type);
+    if ($type == 'default' && is_numeric($setting)) {
+      // language_default was overwritten with the content type setting,
+      // so reset the default language and save the content type setting.
+      variable_set('language_content_type_default', $setting);
+      variable_del('language_default');
+      drupal_set_message('The default language setting has been reset to its default value. Check the ' . l('language configuration page', 'admin/settings/language') . ' to configure it correctly.');
+    }
+    elseif ($type == 'negotiation') {
+      // language_content_type_negotiation is an integer either if it is
+      // the negotiation setting or the content type setting.
+      // The language_negotiation setting is not reset, but
+      // the user is alerted that this setting possibly was overwritten
+      variable_set('language_content_type_negotiation', $setting);
+      drupal_set_message('The language negotiation setting was possibly overwritten by a content type of the same name. Check the ' . l('language configuration page', 'admin/settings/language/configure') . ' and the ' . l('<em>' . $content_type->name . "</em> content type's multilingual support settings", 'admin/build/types/negotiation', array('html' => TRUE)) . ' to configure them correctly.');
+    }
+    elseif (!is_null($setting)) {
+      // Change the language setting variable for any other content type.
+      // Do not worry about language_count, it will be updated below.
+      variable_set('language_content_type_' . $type, $setting);
+      variable_del('language_' . $type);
+    }
+  }
+  // Update language count variable that might be overwritten.
+  $count = db_result(db_query('SELECT COUNT(*) FROM {languages} WHERE enabled = 1'));
+  variable_set('language_count', $count);
+  return array();
+}
+
+/**
+ * Allow longer location.
+ */
+function locale_update_6006() {
+  $ret = array();
+  db_change_field($ret, 'locales_source', 'location', 'location', array('type' => 'text', 'not null' => FALSE));
+  return $ret;
+}
+
+/**
+ * Allow longer location.
+ */
+function locale_update_7000() {
+  $ret = array();
+  db_drop_index($ret, 'locales_source', 'source');
+  db_add_index($ret, 'locales_source', 'source_context', array(array('source', 30), 'context'));
+  return $ret;
+}
+
Index: modules/node/node.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.info,v
retrieving revision 1.11
diff -u -p -r1.11 node.info
--- modules/node/node.info	8 Jun 2009 09:23:53 -0000	1.11
+++ modules/node/node.info	20 Jun 2009 19:43:58 -0000
@@ -11,3 +11,4 @@ files[] = node.pages.inc
 files[] = node.install
 files[] = node.test
 required = TRUE
+files[] = node.update.inc
Index: modules/node/node.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.install,v
retrieving revision 1.24
diff -u -p -r1.24 node.install
--- modules/node/node.install	18 Jun 2009 15:46:30 -0000	1.24
+++ modules/node/node.install	20 Jun 2009 19:43:58 -0000
@@ -347,185 +347,6 @@ function node_schema() {
  */
 
 /**
- * Fix node type 'module' attribute to avoid name-space conflicts.
- */
-function node_update_7000() {
-  $ret = array();
-
-  $ret[] = update_sql("UPDATE {node_type} SET module = 'node_content' WHERE module = 'node'");
-  db_change_field($ret, 'node_type', 'module', 'base', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE));
-
-  return $ret;
-}
-
-/**
- * Rename {node_revisions} table to {node_revision}.
- */
-function node_update_7001() {
-  $ret = array();
-  db_rename_table($ret, 'node_revisions', 'node_revision');
-  return $ret;
-}
-
-/**
- * Extend the node_promote_status index to include all fields required for the node page query.
- */
-function node_update_7002() {
-  $ret = array();
-  db_drop_index($ret, 'node', 'node_promote_status');
-  db_add_index($ret, 'node', 'node_frontpage', array('promote', 'status', 'sticky', 'created'));
-  return $ret;
-}
-
-/**
- * Remove the node_counter if the statistics module is uninstalled.
- */
-function node_update_7003() {
-  $ret = array();
-  if (drupal_get_installed_schema_version('statistics') == SCHEMA_UNINSTALLED) {
-    db_drop_table($ret, 'node_counter');
-  }
-  return $ret;
-}
-
-/**
- * Extend the existing default preview and teaser settings to all node types.
- */
-function node_update_7004() {
-  // Get original settings and all types.
-  $original_length = variable_get('teaser_length', 600);
-  $original_preview = variable_get('node_preview', 0);
-
-  // Map old preview setting to new values order.
-  $original_preview ? $original_preview = 2 : $original_preview = 1;
-  node_type_clear();
-  $type_list = node_type_get_types();
-
-  // Apply original settings to all types.
-  foreach ($type_list as $type => $object) {
-    variable_set('teaser_length_' . $type, $original_length);
-    variable_set('node_preview_' . $type, $original_preview);
-  }
-  // Delete old variable but leave 'teaser_length' for aggregator module upgrade.
-  variable_del('node_preview');
-
-  return array();
-}
-
-/**
- * Convert body and teaser from node properties to fields.
- */
-function node_update_7005(&$context) {
-  $ret = array('#finished' => 0);
-
-  // Get node type info for every invocation.
-  node_type_clear();
-  $node_types = node_type_get_types();
-  $body_types = array();
-  foreach ($node_types as $type => $info) {
-    if ($info->has_body) {
-      $body_types[] = $type;
-    }
-  }
-
-  if (!isset($context['total'])) {
-    // Initial invocation.
-
-    // Re-save node types to create body field instances.
-    foreach ($node_types as $type => $info) {
-      if ($info->has_body) {
-        node_type_save($info);
-      }
-    }
-
-    // Initialize state for future calls.
-    $context['last'] = 0;
-    $context['count'] = 0;
-
-    $query = db_select('node', 'n');
-    $query->join('node_revision', 'nr', 'n.vid = nr.vid');
-    $query->condition('n.type', $body_types, 'IN');
-    $context['total'] = $query->countQuery()->execute()->fetchField();
-  }
-  else {
-    // Subsequent invocations.
-
-    $found = FALSE;
-    if ($context['total']) {
-      // Operate on every revision of every node (whee!), in batches.
-      $batch_size = 50;
-      $query = db_select('node', 'n');
-      $nr = $query->innerJoin('node_revision', 'nr', 'n.vid = nr.vid');
-      $revisions = $query
-        ->fields('n', array('type'))
-        ->fields($nr)
-        ->condition('nr.vid', $context['last'], '>')
-        ->condition('n.type', $body_types, 'IN')
-        ->orderBy('nr.vid', 'ASC')
-        ->execute();
-
-      // Load each reversion of each node, set up 'body'
-      // appropriately, and save the node's field data.  Note that
-      // node_load() will not return the body or teaser values from
-      // {node_revision} because those columns have been removed from the
-      // schema structure in memory (but not yet from the database),
-      // so we get the values from the explicit query of the table
-      // instead.
-      foreach ($revisions as $revision) {
-        $found = TRUE;
-
-        if ($node_types[$revision->type]->has_body) {
-          $node = (object) array(
-            'nid' => $revision->nid,
-            'vid' => $revision->vid,
-            'type' => $revision->type,
-          );
-          if (!empty($revision->teaser) && $revision->teaser != text_summary($revision->body)) {
-            $node->body[0]['summary'] = $revision->teaser;
-          }
-          // Do this after text_summary() above.
-          $break = '<!--break-->';
-          if (substr($revision->body, 0, strlen($break)) == $break) {
-            $revision->body = substr($revision->body, strlen($break));
-          }
-          $node->body[0]['value'] = $revision->body;
-          $node->body[0]['format'] = $revision->format;
-          // This is a core update and no contrib modules are enabled yet, so
-          // we can assume default field storage for a faster update.
-          field_sql_storage_field_storage_write('node', $node, FIELD_STORAGE_INSERT, array());
-        }
-
-        $context['last'] = $revision->vid;
-        $context['count'] += 1;
-
-        if (--$batch_size == 0) {
-          break;
-        }
-      }
-
-      $ret['#finished'] = min(0.99, $context['count'] / $context['total']);
-    }
-
-    if (!$found) {
-      // All nodes are processed.
-      $ret[] = array('success' => TRUE, 'query' => "{$context['total']} node body and teaser properties migrated to the 'body' field.");
-
-      // Remove the now-obsolete body info from node_revision.
-      db_drop_field($ret, 'node_revision', 'body');
-      db_drop_field($ret, 'node_revision', 'teaser');
-      db_drop_field($ret, 'node_revision', 'format');
-
-      // We're done.
-      $ret['#finished'] = 1;
-    }
-  }
-
-  return $ret;
-}
-
-
-
-/**
  * @} End of "defgroup updates-6.x-to-7.x"
  * The next series of updates should start at 8000.
  */
Index: modules/node/node.update.inc
===================================================================
RCS file: modules/node/node.update.inc
diff -N modules/node/node.update.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/node/node.update.inc	20 Jun 2009 19:43:58 -0000
@@ -0,0 +1,187 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Update functions for Node module.
+ */
+
+/**
+ * Fix node type 'module' attribute to avoid name-space conflicts.
+ */
+function node_update_7000() {
+  $ret = array();
+
+  $ret[] = update_sql("UPDATE {node_type} SET module = 'node_content' WHERE module = 'node'");
+  db_change_field($ret, 'node_type', 'module', 'base', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE));
+
+  return $ret;
+}
+
+/**
+ * Rename {node_revisions} table to {node_revision}.
+ */
+function node_update_7001() {
+  $ret = array();
+  db_rename_table($ret, 'node_revisions', 'node_revision');
+  return $ret;
+}
+
+/**
+ * Extend the node_promote_status index to include all fields required for the node page query.
+ */
+function node_update_7002() {
+  $ret = array();
+  db_drop_index($ret, 'node', 'node_promote_status');
+  db_add_index($ret, 'node', 'node_frontpage', array('promote', 'status', 'sticky', 'created'));
+  return $ret;
+}
+
+/**
+ * Remove the node_counter if the statistics module is uninstalled.
+ */
+function node_update_7003() {
+  $ret = array();
+  if (drupal_get_installed_schema_version('statistics') == SCHEMA_UNINSTALLED) {
+    db_drop_table($ret, 'node_counter');
+  }
+  return $ret;
+}
+
+/**
+ * Extend the existing default preview and teaser settings to all node types.
+ */
+function node_update_7004() {
+  // Get original settings and all types.
+  $original_length = variable_get('teaser_length', 600);
+  $original_preview = variable_get('node_preview', 0);
+
+  // Map old preview setting to new values order.
+  $original_preview ? $original_preview = 2 : $original_preview = 1;
+  node_type_clear();
+  $type_list = node_type_get_types();
+
+  // Apply original settings to all types.
+  foreach ($type_list as $type => $object) {
+    variable_set('teaser_length_' . $type, $original_length);
+    variable_set('node_preview_' . $type, $original_preview);
+  }
+  // Delete old variable but leave 'teaser_length' for aggregator module upgrade.
+  variable_del('node_preview');
+
+  return array();
+}
+
+/**
+ * Convert body and teaser from node properties to fields.
+ */
+function node_update_7005(&$context) {
+  $ret = array('#finished' => 0);
+
+  // Get node type info for every invocation.
+  node_type_clear();
+  $node_types = node_type_get_types();
+  $body_types = array();
+  foreach ($node_types as $type => $info) {
+    if ($info->has_body) {
+      $body_types[] = $type;
+    }
+  }
+
+  if (!isset($context['total'])) {
+    // Initial invocation.
+
+    // Re-save node types to create body field instances.
+    foreach ($node_types as $type => $info) {
+      if ($info->has_body) {
+        node_type_save($info);
+      }
+    }
+
+    // Initialize state for future calls.
+    $context['last'] = 0;
+    $context['count'] = 0;
+
+    $query = db_select('node', 'n');
+    $query->join('node_revision', 'nr', 'n.vid = nr.vid');
+    $query->condition('n.type', $body_types, 'IN');
+    $context['total'] = $query->countQuery()->execute()->fetchField();
+  }
+  else {
+    // Subsequent invocations.
+
+    $found = FALSE;
+    if ($context['total']) {
+      // Operate on every revision of every node (whee!), in batches.
+      $batch_size = 50;
+      $query = db_select('node', 'n');
+      $nr = $query->innerJoin('node_revision', 'nr', 'n.vid = nr.vid');
+      $revisions = $query
+        ->fields('n', array('type'))
+        ->fields($nr)
+        ->condition('nr.vid', $context['last'], '>')
+        ->condition('n.type', $body_types, 'IN')
+        ->orderBy('nr.vid', 'ASC')
+        ->execute();
+
+      // Load each reversion of each node, set up 'body'
+      // appropriately, and save the node's field data.  Note that
+      // node_load() will not return the body or teaser values from
+      // {node_revision} because those columns have been removed from the
+      // schema structure in memory (but not yet from the database),
+      // so we get the values from the explicit query of the table
+      // instead.
+      foreach ($revisions as $revision) {
+        $found = TRUE;
+
+        if ($node_types[$revision->type]->has_body) {
+          $node = (object) array(
+            'nid' => $revision->nid,
+            'vid' => $revision->vid,
+            'type' => $revision->type,
+          );
+          if (!empty($revision->teaser) && $revision->teaser != text_summary($revision->body)) {
+            $node->body[0]['summary'] = $revision->teaser;
+          }
+          // Do this after text_summary() above.
+          $break = '<!--break-->';
+          if (substr($revision->body, 0, strlen($break)) == $break) {
+            $revision->body = substr($revision->body, strlen($break));
+          }
+          $node->body[0]['value'] = $revision->body;
+          $node->body[0]['format'] = $revision->format;
+          // This is a core update and no contrib modules are enabled yet, so
+          // we can assume default field storage for a faster update.
+          field_sql_storage_field_storage_write('node', $node, FIELD_STORAGE_INSERT, array());
+        }
+
+        $context['last'] = $revision->vid;
+        $context['count'] += 1;
+
+        if (--$batch_size == 0) {
+          break;
+        }
+      }
+
+      $ret['#finished'] = min(0.99, $context['count'] / $context['total']);
+    }
+
+    if (!$found) {
+      // All nodes are processed.
+      $ret[] = array('success' => TRUE, 'query' => "{$context['total']} node body and teaser properties migrated to the 'body' field.");
+
+      // Remove the now-obsolete body info from node_revision.
+      db_drop_field($ret, 'node_revision', 'body');
+      db_drop_field($ret, 'node_revision', 'teaser');
+      db_drop_field($ret, 'node_revision', 'format');
+
+      // We're done.
+      $ret['#finished'] = 1;
+    }
+  }
+
+  return $ret;
+}
+
+
+
Index: modules/poll/poll.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/poll/poll.info,v
retrieving revision 1.9
diff -u -p -r1.9 poll.info
--- modules/poll/poll.info	8 Jun 2009 09:23:53 -0000	1.9
+++ modules/poll/poll.info	20 Jun 2009 19:43:58 -0000
@@ -8,3 +8,4 @@ files[] = poll.module
 files[] = poll.pages.inc
 files[] = poll.install
 files[] = poll.test
+files[] = poll.update.inc
Index: modules/poll/poll.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/poll/poll.install,v
retrieving revision 1.24
diff -u -p -r1.24 poll.install
--- modules/poll/poll.install	1 Jun 2009 22:07:09 -0000	1.24
+++ modules/poll/poll.install	20 Jun 2009 19:43:58 -0000
@@ -153,26 +153,3 @@ function poll_schema() {
   return $schema;
 }
 
-/**
- * Rename {poll_choices} table to {poll_choice} and {poll_votes} to {poll_vote}.
- */
-function poll_update_7001() {
-  $ret = array();
-  db_rename_table($ret, 'poll_choices', 'poll_choice');
-  db_rename_table($ret, 'poll_votes', 'poll_vote');
-  return $ret;
-}
-
-/**
- * Add timestamp field to {poll_votes}.
- */
-function poll_update_7002() {
-  $ret = array();
-  $field = array(
-    'type' => 'int',
-    'not null' => TRUE,
-    'default' => 0,
-  );
-  db_add_field($ret, 'poll_votes', 'timestamp', $field);
-  return $ret;
-}
Index: modules/poll/poll.update.inc
===================================================================
RCS file: modules/poll/poll.update.inc
diff -N modules/poll/poll.update.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/poll/poll.update.inc	20 Jun 2009 19:43:58 -0000
@@ -0,0 +1,31 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Update functions for Poll module.
+ */
+
+/**
+ * Rename {poll_choices} table to {poll_choice} and {poll_votes} to {poll_vote}.
+ */
+function poll_update_7001() {
+  $ret = array();
+  db_rename_table($ret, 'poll_choices', 'poll_choice');
+  db_rename_table($ret, 'poll_votes', 'poll_vote');
+  return $ret;
+}
+
+/**
+ * Add timestamp field to {poll_votes}.
+ */
+function poll_update_7002() {
+  $ret = array();
+  $field = array(
+    'type' => 'int',
+    'not null' => TRUE,
+    'default' => 0,
+  );
+  db_add_field($ret, 'poll_votes', 'timestamp', $field);
+  return $ret;
+}
Index: modules/profile/profile.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/profile/profile.info,v
retrieving revision 1.9
diff -u -p -r1.9 profile.info
--- modules/profile/profile.info	8 Jun 2009 09:23:53 -0000	1.9
+++ modules/profile/profile.info	20 Jun 2009 19:43:58 -0000
@@ -9,3 +9,4 @@ files[] = profile.admin.inc
 files[] = profile.pages.inc
 files[] = profile.install
 files[] = profile.test
+files[] = profile.update.inc
Index: modules/profile/profile.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/profile/profile.install,v
retrieving revision 1.20
diff -u -p -r1.20 profile.install
--- modules/profile/profile.install	1 Jun 2009 22:07:09 -0000	1.20
+++ modules/profile/profile.install	20 Jun 2009 19:43:58 -0000
@@ -158,12 +158,3 @@ function profile_schema() {
   return $schema;
 }
 
-/**
- * Rename {profile_fields} table to {profile_field} and {profile_values} to {profile_value}.
- */
-function profile_update_7001() {
-  $ret = array();
-  db_rename_table($ret, 'profile_fields', 'profile_field');
-  db_rename_table($ret, 'profile_values', 'profile_value');
-  return $ret;
-}
Index: modules/profile/profile.update.inc
===================================================================
RCS file: modules/profile/profile.update.inc
diff -N modules/profile/profile.update.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/profile/profile.update.inc	20 Jun 2009 19:43:58 -0000
@@ -0,0 +1,17 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Update functions for Profile module.
+ */
+
+/**
+ * Rename {profile_fields} table to {profile_field} and {profile_values} to {profile_value}.
+ */
+function profile_update_7001() {
+  $ret = array();
+  db_rename_table($ret, 'profile_fields', 'profile_field');
+  db_rename_table($ret, 'profile_values', 'profile_value');
+  return $ret;
+}
Index: modules/search/search.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.info,v
retrieving revision 1.9
diff -u -p -r1.9 search.info
--- modules/search/search.info	19 Jun 2009 06:26:51 -0000	1.9
+++ modules/search/search.info	20 Jun 2009 19:43:58 -0000
@@ -9,3 +9,4 @@ files[] = search.admin.inc
 files[] = search.pages.inc
 files[] = search.install
 files[] = search.test
+files[] = search.update.inc
Index: modules/search/search.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.install,v
retrieving revision 1.22
diff -u -p -r1.22 search.install
--- modules/search/search.install	1 Jun 2009 22:07:09 -0000	1.22
+++ modules/search/search.install	20 Jun 2009 19:43:58 -0000
@@ -161,17 +161,3 @@ function search_schema() {
   return $schema;
 }
 
-/**
- * Replace unique keys in 'search_dataset' and 'search_index' by primary keys.
- */
-function search_update_7000() {
-  $ret = array();
-  db_drop_unique_key($ret, 'search_dataset', 'sid_type');
-  db_add_primary_key($ret, 'search_dataset', array('sid', 'type'));
-
-  db_drop_index($ret, 'search_index', 'word');
-  db_drop_unique_key($ret, 'search_index', 'word_sid_type');
-  db_add_primary_key($ret, 'search_index', array('word', 'sid', 'type'));
-
-  return $ret;
-}
Index: modules/search/search.update.inc
===================================================================
RCS file: modules/search/search.update.inc
diff -N modules/search/search.update.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/search/search.update.inc	20 Jun 2009 19:43:58 -0000
@@ -0,0 +1,22 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Update functions for Search module.
+ */
+
+/**
+ * Replace unique keys in 'search_dataset' and 'search_index' by primary keys.
+ */
+function search_update_7000() {
+  $ret = array();
+  db_drop_unique_key($ret, 'search_dataset', 'sid_type');
+  db_add_primary_key($ret, 'search_dataset', array('sid', 'type'));
+
+  db_drop_index($ret, 'search_index', 'word');
+  db_drop_unique_key($ret, 'search_index', 'word_sid_type');
+  db_add_primary_key($ret, 'search_index', array('word', 'sid', 'type'));
+
+  return $ret;
+}
Index: modules/statistics/statistics.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/statistics/statistics.info,v
retrieving revision 1.9
diff -u -p -r1.9 statistics.info
--- modules/statistics/statistics.info	8 Jun 2009 09:23:54 -0000	1.9
+++ modules/statistics/statistics.info	20 Jun 2009 19:43:58 -0000
@@ -9,3 +9,4 @@ files[] = statistics.admin.inc
 files[] = statistics.pages.inc
 files[] = statistics.install
 files[] = statistics.test
+files[] = statistics.update.inc
Index: modules/statistics/statistics.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/statistics/statistics.install,v
retrieving revision 1.21
diff -u -p -r1.21 statistics.install
--- modules/statistics/statistics.install	1 Jun 2009 22:07:10 -0000	1.21
+++ modules/statistics/statistics.install	20 Jun 2009 19:43:58 -0000
@@ -150,15 +150,6 @@ function statistics_schema() {
  */
 
 /**
- * Allow longer referrers.
- */
-function statistics_update_7000() {
-  $ret = array();
-  db_change_field($ret, 'accesslog', 'url', 'url', array('type' => 'text', 'not null' => FALSE));
-  return $ret;
-}
-
-/**
  * @} End of "defgroup updates-6.x-to-7.x"
  * The next series of updates should start at 8000.
  */
Index: modules/statistics/statistics.update.inc
===================================================================
RCS file: modules/statistics/statistics.update.inc
diff -N modules/statistics/statistics.update.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/statistics/statistics.update.inc	20 Jun 2009 19:43:58 -0000
@@ -0,0 +1,17 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Update functions for Statistics module.
+ */
+
+/**
+ * Allow longer referrers.
+ */
+function statistics_update_7000() {
+  $ret = array();
+  db_change_field($ret, 'accesslog', 'url', 'url', array('type' => 'text', 'not null' => FALSE));
+  return $ret;
+}
+
Index: modules/taxonomy/taxonomy.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.info,v
retrieving revision 1.9
diff -u -p -r1.9 taxonomy.info
--- modules/taxonomy/taxonomy.info	8 Jun 2009 09:23:54 -0000	1.9
+++ modules/taxonomy/taxonomy.info	20 Jun 2009 19:43:58 -0000
@@ -9,3 +9,4 @@ files[] = taxonomy.admin.inc
 files[] = taxonomy.pages.inc
 files[] = taxonomy.install
 files[] = taxonomy.test
+files[] = taxonomy.update.inc
Index: modules/taxonomy/taxonomy.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.install,v
retrieving revision 1.20
diff -u -p -r1.20 taxonomy.install
--- modules/taxonomy/taxonomy.install	18 Jun 2009 15:46:30 -0000	1.20
+++ modules/taxonomy/taxonomy.install	20 Jun 2009 19:43:58 -0000
@@ -337,28 +337,3 @@ function taxonomy_schema() {
   return $schema;
 }
 
-/**
- * Add vocabulary machine_name column.
- */
-function taxonomy_update_7002() {
-  $ret = array();
-  $field = array(
-    'type' => 'varchar',
-    'length' => 255,
-    'not null' => TRUE,
-    'default' => '',
-    'description' => 'The vocabulary machine name.',
-  );
-
-  db_add_field($ret, 'taxonomy_vocabulary', 'machine_name', $field);
-
-  foreach (taxonomy_get_vocabularies() as $vid => $vocabulary) {
-    $machine_name = 'vocabulary_' . $vid;
-    db_update('taxonomy_vocabulary')
-      ->fields(array('machine_name' => 'vocabulary_' . $vid))
-      ->condition('vid', $vid)
-      ->execute();
-    field_attach_create_bundle($machine_name);
-  }
-  return $ret;
-}
Index: modules/taxonomy/taxonomy.update.inc
===================================================================
RCS file: modules/taxonomy/taxonomy.update.inc
diff -N modules/taxonomy/taxonomy.update.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/taxonomy/taxonomy.update.inc	20 Jun 2009 19:43:58 -0000
@@ -0,0 +1,33 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Update functions for Taxonomy module.
+ */
+
+/**
+ * Add vocabulary machine_name column.
+ */
+function taxonomy_update_7002() {
+  $ret = array();
+  $field = array(
+    'type' => 'varchar',
+    'length' => 255,
+    'not null' => TRUE,
+    'default' => '',
+    'description' => 'The vocabulary machine name.',
+  );
+
+  db_add_field($ret, 'taxonomy_vocabulary', 'machine_name', $field);
+
+  foreach (taxonomy_get_vocabularies() as $vid => $vocabulary) {
+    $machine_name = 'vocabulary_' . $vid;
+    db_update('taxonomy_vocabulary')
+      ->fields(array('machine_name' => 'vocabulary_' . $vid))
+      ->condition('vid', $vid)
+      ->execute();
+    field_attach_create_bundle($machine_name);
+  }
+  return $ret;
+}
Index: modules/update/update.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/update/update.info,v
retrieving revision 1.5
diff -u -p -r1.5 update.info
--- modules/update/update.info	11 Oct 2008 02:33:12 -0000	1.5
+++ modules/update/update.info	20 Jun 2009 19:43:57 -0000
@@ -10,3 +10,4 @@ files[] = update.fetch.inc
 files[] = update.report.inc
 files[] = update.settings.inc
 files[] = update.install
+files[] = update.update.inc
Index: modules/update/update.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/update/update.install,v
retrieving revision 1.8
diff -u -p -r1.8 update.install
--- modules/update/update.install	27 May 2009 18:34:02 -0000	1.8
+++ modules/update/update.install	20 Jun 2009 19:43:57 -0000
@@ -60,10 +60,3 @@ function _update_remove_update_status_va
   variable_del('update_status_fetch_url');
 }
 
-/**
- * Clear out stale variables from update_status.
- */
-function update_update_6000() {
-  _update_remove_update_status_variables();
-  return array();
-}
Index: modules/update/update.update.inc
===================================================================
RCS file: modules/update/update.update.inc
diff -N modules/update/update.update.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/update/update.update.inc	20 Jun 2009 19:43:57 -0000
@@ -0,0 +1,15 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Update functions for Update module.
+ */
+
+/**
+ * Clear out stale variables from update_status.
+ */
+function update_update_6000() {
+  _update_remove_update_status_variables();
+  return array();
+}
Index: modules/user/user.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.info,v
retrieving revision 1.11
diff -u -p -r1.11 user.info
--- modules/user/user.info	8 Jun 2009 09:23:55 -0000	1.11
+++ modules/user/user.info	20 Jun 2009 19:43:57 -0000
@@ -10,3 +10,4 @@ files[] = user.pages.inc
 files[] = user.install
 files[] = user.test
 required = TRUE
+files[] = user.update.inc
Index: modules/user/user.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.install,v
retrieving revision 1.26
diff -u -p -r1.26 user.install
--- modules/user/user.install	1 Jun 2009 22:07:10 -0000	1.26
+++ modules/user/user.install	20 Jun 2009 19:43:57 -0000
@@ -249,239 +249,6 @@ function user_schema() {
  */
 
 /**
- * Increase the length of the password field to accommodate better hashes.
- *
- * Also re-hashes all current passwords to improve security. This may be a
- * lengthy process, and is performed batch-wise.
- */
-function user_update_7000(&$sandbox) {
-  $ret = array('#finished' => 0);
-  // Lower than DRUPAL_HASH_COUNT to make the update run at a reasonable speed.
-  $hash_count_log2 = 11;
-  // Multi-part update.
-  if (!isset($sandbox['user_from'])) {
-    db_change_field($ret, 'users', 'pass', 'pass', array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => ''));
-    $sandbox['user_from'] = 0;
-    $sandbox['user_count'] = db_query("SELECT COUNT(uid) FROM {users}")->fetchField();
-  }
-  else {
-    require_once DRUPAL_ROOT . '/' . variable_get('password_inc', 'includes/password.inc');
-    //  Hash again all current hashed passwords.
-    $has_rows = FALSE;
-    // Update this many per page load.
-    $count = 1000;
-    $result = db_query_range("SELECT uid, pass FROM {users} WHERE uid > 0 ORDER BY uid", array(), $sandbox['user_from'], $count);
-    foreach ($result as $account) {
-      $has_rows = TRUE;
-      $new_hash = user_hash_password($account->pass, $hash_count_log2);
-      if ($new_hash) {
-        // Indicate an updated password.
-        $new_hash  = 'U' . $new_hash;
-        db_update('users')
-          ->fields(array('pass' => $new_hash))
-          ->condition('uid', $account->uid)
-          ->execute();
-      }
-    }
-    $ret['#finished'] = $sandbox['user_from']/$sandbox['user_count'];
-    $sandbox['user_from'] += $count;
-    if (!$has_rows) {
-      $ret['#finished'] = 1;
-      $ret[] = array('success' => TRUE, 'query' => "UPDATE {users} SET pass = 'U' . user_hash_password(pass) WHERE uid > 0");
-    }
-  }
-  return $ret;
-}
-
-/**
- * Remove the 'threshold', 'mode' and 'sort' columns from the {users} table.
- *
- * These fields were previously used to store per-user comment settings.
- */
-
-function user_update_7001() {
-  $ret = array();
-  db_drop_field($ret, 'users', 'threshold');
-  db_drop_field($ret, 'users', 'mode');
-  db_drop_field($ret, 'users', 'sort');
-
-  return $ret;
-}
-
-/**
- * Convert user time zones from time zone offsets to time zone names.
- */
-function user_update_7002(&$sandbox) {
-  $ret = array('#finished' => 0);
-
-  // Multi-part update.
-  if (!isset($sandbox['user_from'])) {
-    db_change_field($ret, 'users', 'timezone', 'timezone', array('type' => 'varchar', 'length' => 32, 'not null' => FALSE));
-    $sandbox['user_from'] = 0;
-    $sandbox['user_count'] = db_query("SELECT COUNT(uid) FROM {users}")->fetchField();
-    $sandbox['user_not_migrated'] = 0;
-  }
-  else {
-    $timezones = system_time_zones();
-    // Update this many per page load.
-    $count = 10000;
-    $contributed_date_module = db_column_exists('users', 'timezone_name');
-    $contributed_event_module = db_column_exists('users', 'timezone_id');
-
-    $results = db_query_range("SELECT uid FROM {users} ORDER BY uid", array(), $sandbox['user_from'], $count);
-    foreach ($results as $account) {
-      $timezone = NULL;
-      // If the contributed Date module has created a users.timezone_name
-      // column, use this data to set each user's time zone.
-      if ($contributed_date_module) {
-        $date_timezone = db_query("SELECT timezone_name FROM {users} WHERE uid = :uid", array(':uid' => $account->uid))->fetchField();
-        if (isset($timezones[$date_timezone])) {
-          $timezone = $date_timezone;
-        }
-      }
-      // If the contributed Event module has stored user time zone information
-      // use that information to update the user accounts.
-      if (!$timezone && $contributed_event_module) {
-        try {
-          $event_timezone = db_query("SELECT t.name FROM {users} u LEFT JOIN {event_timezones} t ON u.timezone_id = t.timezone WHERE u.uid = :uid", array(':uid' => $account->uid))->fetchField();
-          $event_timezone = str_replace(' ', '_', $event_timezone);
-          if (isset($timezones[$event_timezone])) {
-            $timezone = $event_timezone;
-          }
-        }
-        catch (PDOException $e) {
-          // Ignore error if event_timezones table does not exist or unexpected
-          // schema found.
-        }
-      }
-      if ($timezone) {
-        db_query("UPDATE {users} SET timezone = :timezone WHERE uid = :uid", array(':timezone' => $timezone, ':uid' => $account->uid));
-      }
-      else {
-        $sandbox['user_not_migrated']++;
-        db_query("UPDATE {users} SET timezone = NULL WHERE uid = :uid", array(':uid' => $account->uid));
-      }
-      $sandbox['user_from']++;
-    }
-
-    $ret['#finished'] = $sandbox['user_from'] / $sandbox['user_count'];
-    if ($sandbox['user_from'] == $sandbox['user_count']) {
-      $ret[] = array('success' => TRUE, 'query' => "Migrate user time zones.");
-      if ($sandbox['user_not_migrated'] > 0) {
-        variable_set('empty_timezone_message', 1);
-        drupal_set_message('Some user time zones have been emptied and need to be set to the correct values. Use the new ' . l('time zone options', 'admin/settings/regional-settings') . ' to choose whether to remind users at login to set the correct time zone.', 'warning');
-      }
-    }
-  }
-  return $ret;
-}
-
-/**
- * Update user settings for cancelling user accounts.
- *
- * Prior to 7.x, users were not able to cancel their accounts. When
- * administrators deleted an account, all contents were assigned to uid 0,
- * which is the same as the 'user_cancel_reassign' method now.
- */
-function user_update_7003() {
-  $ret = array();
-  // Set the default account cancellation method.
-  variable_set('user_cancel_method', 'user_cancel_reassign');
-  // Re-assign notification setting.
-  if ($setting = variable_get('user_mail_status_deleted_notify', FALSE)) {
-    variable_set('user_mail_status_canceled_notify', $setting);
-    variable_del('user_mail_status_deleted_notify');
-  }
-  // Re-assign "Account deleted" mail strings to "Account canceled" mail.
-  if ($setting = variable_get('user_mail_status_deleted_subject', FALSE)) {
-    variable_set('user_mail_status_canceled_subject', $setting);
-    variable_del('user_mail_status_deleted_subject');
-  }
-  if ($setting = variable_get('user_mail_status_deleted_body', FALSE)) {
-    variable_set('user_mail_status_canceled_body', $setting);
-    variable_del('user_mail_status_deleted_body');
-  }
-  return $ret;
-}
-
-/**
- * Add the user's pictures to the {files} table and make them managed files.
- */
-function user_update_7004(&$sandbox) {
-  $ret = array();
-
-  $picture_field = array(
-    'type' => 'int',
-    'not null' => TRUE,
-    'default' => 0,
-    'description' => t("Foriegn key: {files}.fid of user's picture."),
-  );
-
-  if (!isset($sandbox['progress'])) {
-    // Check that the field hasn't been updated in an aborted run of this
-    // update.
-    if (!db_column_exists('users', 'picture_fid')) {
-      // Add a new field for the fid.
-      db_add_field($ret, 'users', 'picture_fid', $picture_field);
-    }
-
-    // Initialize batch update information.
-    $sandbox['progress'] = 0;
-    $sandbox['last_user_processed'] = -1;
-    $sandbox['max'] = db_query("SELECT COUNT(*) FROM {users} WHERE picture <> ''")->fetchField();
-  }
-
-  // As a batch operation move the photos into the {files} table and update the
-  // {users} records.
-  $limit = 500;
-  $result = db_query_range("SELECT uid, picture FROM {users} WHERE picture <> '' AND uid > :uid ORDER BY uid", array(':uid' => $sandbox['last_user_processed']), 0, $limit);
-  foreach ($result as $user) {
-    // Don't bother adding files that don't exist.
-    if (!file_exists($user->picture)) {
-      continue;
-    }
-
-    // Check if the file already exists.
-    $files = file_load_multiple(array(), array('filepath' => $user->picture));
-    if (count($files)) {
-      $file = reset($files);
-    }
-    else {
-      // Create a file object.
-      $file = new stdClass();
-      $file->filepath = $user->picture;
-      $file->filename = basename($file->filepath);
-      $file->filemime = file_get_mimetype($file->filepath);
-      $file->uid      = $user->uid;
-      $file->status   = FILE_STATUS_PERMANENT;
-      $file = file_save($file);
-    }
-
-    db_update('users')
-      ->fields(array('picture_fid' => $file->fid))
-      ->condition('uid', $user->uid)
-      ->execute();
-
-    // Update our progress information for the batch update.
-    $sandbox['progress']++;
-    $sandbox['last_user_processed'] = $user->uid;
-  }
-
-  // Indicate our current progress to the batch update system. If there's no
-  // max value then there's nothing to update and we're finished.
-  $ret['#finished'] = empty($sandbox['max']) ? 1 : ($sandbox['progress'] / $sandbox['max']);
-
-  // When we're finished, drop the old picture field and rename the new one to
-  // replace it.
-  if (isset($ret['#finished']) && $ret['#finished'] == 1) {
-    db_drop_field($ret, 'users', 'picture');
-    db_change_field($ret, 'users', 'picture_fid', 'picture', $picture_field);
-  }
-
-  return $ret;
-}
-
-/**
  * @} End of "defgroup user-updates-6.x-to-7.x"
  * The next series of updates should start at 8000.
  */
Index: modules/user/user.update.inc
===================================================================
RCS file: modules/user/user.update.inc
diff -N modules/user/user.update.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/user/user.update.inc	20 Jun 2009 19:43:57 -0000
@@ -0,0 +1,241 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Update functions for User module.
+ */
+
+/**
+ * Increase the length of the password field to accommodate better hashes.
+ *
+ * Also re-hashes all current passwords to improve security. This may be a
+ * lengthy process, and is performed batch-wise.
+ */
+function user_update_7000(&$sandbox) {
+  $ret = array('#finished' => 0);
+  // Lower than DRUPAL_HASH_COUNT to make the update run at a reasonable speed.
+  $hash_count_log2 = 11;
+  // Multi-part update.
+  if (!isset($sandbox['user_from'])) {
+    db_change_field($ret, 'users', 'pass', 'pass', array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => ''));
+    $sandbox['user_from'] = 0;
+    $sandbox['user_count'] = db_query("SELECT COUNT(uid) FROM {users}")->fetchField();
+  }
+  else {
+    require_once DRUPAL_ROOT . '/' . variable_get('password_inc', 'includes/password.inc');
+    //  Hash again all current hashed passwords.
+    $has_rows = FALSE;
+    // Update this many per page load.
+    $count = 1000;
+    $result = db_query_range("SELECT uid, pass FROM {users} WHERE uid > 0 ORDER BY uid", array(), $sandbox['user_from'], $count);
+    foreach ($result as $account) {
+      $has_rows = TRUE;
+      $new_hash = user_hash_password($account->pass, $hash_count_log2);
+      if ($new_hash) {
+        // Indicate an updated password.
+        $new_hash  = 'U' . $new_hash;
+        db_update('users')
+          ->fields(array('pass' => $new_hash))
+          ->condition('uid', $account->uid)
+          ->execute();
+      }
+    }
+    $ret['#finished'] = $sandbox['user_from']/$sandbox['user_count'];
+    $sandbox['user_from'] += $count;
+    if (!$has_rows) {
+      $ret['#finished'] = 1;
+      $ret[] = array('success' => TRUE, 'query' => "UPDATE {users} SET pass = 'U' . user_hash_password(pass) WHERE uid > 0");
+    }
+  }
+  return $ret;
+}
+
+/**
+ * Remove the 'threshold', 'mode' and 'sort' columns from the {users} table.
+ *
+ * These fields were previously used to store per-user comment settings.
+ */
+
+function user_update_7001() {
+  $ret = array();
+  db_drop_field($ret, 'users', 'threshold');
+  db_drop_field($ret, 'users', 'mode');
+  db_drop_field($ret, 'users', 'sort');
+
+  return $ret;
+}
+
+/**
+ * Convert user time zones from time zone offsets to time zone names.
+ */
+function user_update_7002(&$sandbox) {
+  $ret = array('#finished' => 0);
+
+  // Multi-part update.
+  if (!isset($sandbox['user_from'])) {
+    db_change_field($ret, 'users', 'timezone', 'timezone', array('type' => 'varchar', 'length' => 32, 'not null' => FALSE));
+    $sandbox['user_from'] = 0;
+    $sandbox['user_count'] = db_query("SELECT COUNT(uid) FROM {users}")->fetchField();
+    $sandbox['user_not_migrated'] = 0;
+  }
+  else {
+    $timezones = system_time_zones();
+    // Update this many per page load.
+    $count = 10000;
+    $contributed_date_module = db_column_exists('users', 'timezone_name');
+    $contributed_event_module = db_column_exists('users', 'timezone_id');
+
+    $results = db_query_range("SELECT uid FROM {users} ORDER BY uid", array(), $sandbox['user_from'], $count);
+    foreach ($results as $account) {
+      $timezone = NULL;
+      // If the contributed Date module has created a users.timezone_name
+      // column, use this data to set each user's time zone.
+      if ($contributed_date_module) {
+        $date_timezone = db_query("SELECT timezone_name FROM {users} WHERE uid = :uid", array(':uid' => $account->uid))->fetchField();
+        if (isset($timezones[$date_timezone])) {
+          $timezone = $date_timezone;
+        }
+      }
+      // If the contributed Event module has stored user time zone information
+      // use that information to update the user accounts.
+      if (!$timezone && $contributed_event_module) {
+        try {
+          $event_timezone = db_query("SELECT t.name FROM {users} u LEFT JOIN {event_timezones} t ON u.timezone_id = t.timezone WHERE u.uid = :uid", array(':uid' => $account->uid))->fetchField();
+          $event_timezone = str_replace(' ', '_', $event_timezone);
+          if (isset($timezones[$event_timezone])) {
+            $timezone = $event_timezone;
+          }
+        }
+        catch (PDOException $e) {
+          // Ignore error if event_timezones table does not exist or unexpected
+          // schema found.
+        }
+      }
+      if ($timezone) {
+        db_query("UPDATE {users} SET timezone = :timezone WHERE uid = :uid", array(':timezone' => $timezone, ':uid' => $account->uid));
+      }
+      else {
+        $sandbox['user_not_migrated']++;
+        db_query("UPDATE {users} SET timezone = NULL WHERE uid = :uid", array(':uid' => $account->uid));
+      }
+      $sandbox['user_from']++;
+    }
+
+    $ret['#finished'] = $sandbox['user_from'] / $sandbox['user_count'];
+    if ($sandbox['user_from'] == $sandbox['user_count']) {
+      $ret[] = array('success' => TRUE, 'query' => "Migrate user time zones.");
+      if ($sandbox['user_not_migrated'] > 0) {
+        variable_set('empty_timezone_message', 1);
+        drupal_set_message('Some user time zones have been emptied and need to be set to the correct values. Use the new ' . l('time zone options', 'admin/settings/regional-settings') . ' to choose whether to remind users at login to set the correct time zone.', 'warning');
+      }
+    }
+  }
+  return $ret;
+}
+
+/**
+ * Update user settings for cancelling user accounts.
+ *
+ * Prior to 7.x, users were not able to cancel their accounts. When
+ * administrators deleted an account, all contents were assigned to uid 0,
+ * which is the same as the 'user_cancel_reassign' method now.
+ */
+function user_update_7003() {
+  $ret = array();
+  // Set the default account cancellation method.
+  variable_set('user_cancel_method', 'user_cancel_reassign');
+  // Re-assign notification setting.
+  if ($setting = variable_get('user_mail_status_deleted_notify', FALSE)) {
+    variable_set('user_mail_status_canceled_notify', $setting);
+    variable_del('user_mail_status_deleted_notify');
+  }
+  // Re-assign "Account deleted" mail strings to "Account canceled" mail.
+  if ($setting = variable_get('user_mail_status_deleted_subject', FALSE)) {
+    variable_set('user_mail_status_canceled_subject', $setting);
+    variable_del('user_mail_status_deleted_subject');
+  }
+  if ($setting = variable_get('user_mail_status_deleted_body', FALSE)) {
+    variable_set('user_mail_status_canceled_body', $setting);
+    variable_del('user_mail_status_deleted_body');
+  }
+  return $ret;
+}
+
+/**
+ * Add the user's pictures to the {files} table and make them managed files.
+ */
+function user_update_7004(&$sandbox) {
+  $ret = array();
+
+  $picture_field = array(
+    'type' => 'int',
+    'not null' => TRUE,
+    'default' => 0,
+    'description' => t("Foriegn key: {files}.fid of user's picture."),
+  );
+
+  if (!isset($sandbox['progress'])) {
+    // Check that the field hasn't been updated in an aborted run of this
+    // update.
+    if (!db_column_exists('users', 'picture_fid')) {
+      // Add a new field for the fid.
+      db_add_field($ret, 'users', 'picture_fid', $picture_field);
+    }
+
+    // Initialize batch update information.
+    $sandbox['progress'] = 0;
+    $sandbox['last_user_processed'] = -1;
+    $sandbox['max'] = db_query("SELECT COUNT(*) FROM {users} WHERE picture <> ''")->fetchField();
+  }
+
+  // As a batch operation move the photos into the {files} table and update the
+  // {users} records.
+  $limit = 500;
+  $result = db_query_range("SELECT uid, picture FROM {users} WHERE picture <> '' AND uid > :uid ORDER BY uid", array(':uid' => $sandbox['last_user_processed']), 0, $limit);
+  foreach ($result as $user) {
+    // Don't bother adding files that don't exist.
+    if (!file_exists($user->picture)) {
+      continue;
+    }
+
+    // Check if the file already exists.
+    $files = file_load_multiple(array(), array('filepath' => $user->picture));
+    if (count($files)) {
+      $file = reset($files);
+    }
+    else {
+      // Create a file object.
+      $file = new stdClass();
+      $file->filepath = $user->picture;
+      $file->filename = basename($file->filepath);
+      $file->filemime = file_get_mimetype($file->filepath);
+      $file->uid      = $user->uid;
+      $file->status   = FILE_STATUS_PERMANENT;
+      $file = file_save($file);
+    }
+
+    db_update('users')
+      ->fields(array('picture_fid' => $file->fid))
+      ->condition('uid', $user->uid)
+      ->execute();
+
+    // Update our progress information for the batch update.
+    $sandbox['progress']++;
+    $sandbox['last_user_processed'] = $user->uid;
+  }
+
+  // Indicate our current progress to the batch update system. If there's no
+  // max value then there's nothing to update and we're finished.
+  $ret['#finished'] = empty($sandbox['max']) ? 1 : ($sandbox['progress'] / $sandbox['max']);
+
+  // When we're finished, drop the old picture field and rename the new one to
+  // replace it.
+  if (isset($ret['#finished']) && $ret['#finished'] == 1) {
+    db_drop_field($ret, 'users', 'picture');
+    db_change_field($ret, 'users', 'picture_fid', 'picture', $picture_field);
+  }
+
+  return $ret;
+}
+
