Index: modules/blog/blog.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/blog/blog.module,v
retrieving revision 1.309
diff -u -p -r1.309 blog.module
--- modules/blog/blog.module	22 Jul 2008 20:00:55 -0000	1.309
+++ modules/blog/blog.module	27 Sep 2008 00:58:21 -0000
@@ -13,7 +13,7 @@ function blog_node_info() {
   return array(
     'blog' => array(
       'name' => t('Blog entry'),
-      'module' => 'blog',
+      'base' => 'blog',
       'description' => t('A <em>blog entry</em> is a single post to an online journal, or <em>blog</em>.'),
     )
   );
Index: modules/book/book.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/book/book.install,v
retrieving revision 1.22
diff -u -p -r1.22 book.install
--- modules/book/book.install	15 May 2008 21:19:24 -0000	1.22
+++ modules/book/book.install	27 Sep 2008 00:58:21 -0000
@@ -27,7 +27,7 @@ function _book_install_type_create() {
   $book_node_type = array(
     'type' => 'book',
     'name' => t('Book page'),
-    'module' => 'node',
+    'base' => 'node_content',
     'description' => t('A <em>book page</em> is a page of content, organized into a collection of related entries collectively known as a <em>book</em>. A <em>book page</em> automatically displays links to adjacent pages, providing a simple navigation system for organizing and reviewing structured content.'),
     'custom' => TRUE,
     'modified' => TRUE,
Index: modules/forum/forum.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum/forum.module,v
retrieving revision 1.464
diff -u -p -r1.464 forum.module
--- modules/forum/forum.module	19 Sep 2008 20:25:02 -0000	1.464
+++ modules/forum/forum.module	27 Sep 2008 00:58:22 -0000
@@ -224,7 +224,7 @@ function forum_nodeapi(&$node, $op, $tea
         foreach ($node->taxonomy as $term) {
           if (db_result(db_query('SELECT COUNT(*) FROM {term_data} WHERE tid = %d AND vid = %d', $term, $vocabulary))) {
             if (in_array($term, $containers)) {
-              $term = taxonomy_term_load($term);
+              $term = taxonomy_get_term_data($term);
               form_set_error('taxonomy', t('The item %forum is only a container for forums. Please select one of the forums below it.', array('%forum' => $term->name)));
             }
           }
@@ -292,7 +292,7 @@ function forum_node_info() {
   return array(
     'forum' => array(
       'name' => t('Forum topic'),
-      'module' => 'forum',
+      'base' => 'forum',
       'description' => t('A <em>forum topic</em> is the initial post to a new discussion thread within a forum.'),
       'title_label' => t('Subject'),
     )
@@ -565,8 +565,6 @@ function forum_get_topics($tid, $sortby,
     }
   }
 
-  $term = taxonomy_term_load($tid);
-
   $sql = db_rewrite_sql("SELECT n.nid, r.tid, n.title, n.type, n.sticky, u.name, u.uid, n.created AS timestamp, n.comment AS comment_mode, l.last_comment_timestamp, IF(l.last_comment_uid != 0, cu.name, l.last_comment_name) AS last_comment_name, l.last_comment_uid, l.comment_count AS num_comments, f.tid AS forum_tid FROM {node_comment_statistics} l INNER JOIN {node} n ON n.nid = l.nid INNER JOIN {users} cu ON l.last_comment_uid = cu.uid INNER JOIN {term_node} r ON n.vid = r.vid INNER JOIN {users} u ON n.uid = u.uid INNER JOIN {forum} f ON n.vid = f.vid WHERE n.status = 1 AND r.tid = %d");
   $sql .= tablesort_sql($forum_topic_list_header, 'n.sticky DESC,');
   $sql .= ', n.created DESC';  // Always add a secondary sort order so that the news forum topics are on top.
Index: modules/node/content_types.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/content_types.inc,v
retrieving revision 1.57
diff -u -p -r1.57 content_types.inc
--- modules/node/content_types.inc	16 Jul 2008 21:59:27 -0000	1.57
+++ modules/node/content_types.inc	27 Sep 2008 00:58:22 -0000
@@ -51,7 +51,7 @@ function node_overview_types() {
 function node_type_form(&$form_state, $type = NULL) {
   if (!isset($type->type)) {
     $type = new stdClass();
-    $type->type = $type->name = $type->module = $type->description = $type->help = '';
+    $type->type = $type->name = $type->base = $type->description = $type->help = '';
     $type->min_word_count = 0;
     $type->has_title = TRUE;
     $type->has_body = TRUE;
@@ -170,9 +170,9 @@ function node_type_form(&$form_state, $t
     '#type' => 'value',
     '#value' => isset($type->orig_type) ? $type->orig_type : '',
   );
-  $form['module'] = array(
+  $form['base'] = array(
     '#type' => 'value',
-    '#value' => $type->module,
+    '#value' => $type->base,
   );
   $form['custom'] = array(
     '#type' => 'value',
@@ -271,7 +271,7 @@ function node_type_form_submit($form, &$
   $type->has_title = ($type->title_label != '');
   $type->has_body = ($type->body_label != '');
 
-  $type->module = !empty($form_state['values']['module']) ? $form_state['values']['module'] : 'node';
+  $type->base = !empty($form_state['values']['base']) ? $form_state['values']['base'] : 'node_content';
   $type->custom = $form_state['values']['custom'];
   $type->modified = TRUE;
   $type->locked = $form_state['values']['locked'];
Index: modules/node/node.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.install,v
retrieving revision 1.6
diff -u -p -r1.6 node.install
--- modules/node/node.install	15 Apr 2008 08:39:03 -0000	1.6
+++ modules/node/node.install	27 Sep 2008 00:58:22 -0000
@@ -293,8 +293,8 @@ function node_schema() {
         'not null' => TRUE,
         'default' => '',
       ),
-      'module' => array(
-        'description' => t('The module that implements this type.'),
+      'base' => array(
+        'description' => t('The base string used to construct callbacks corresponding to this node type.'),
         'type' => 'varchar',
         'length' => 255,
         'not null' => TRUE,
@@ -380,3 +380,23 @@ function node_schema() {
 
   return $schema;
 }
+
+/**
+ * Drupal 6.x to 7.x updates
+ */
+
+/**
+ * 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;
+}
+
+/**
+ * End of 6.x to 7.x updates
+ */
Index: modules/node/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.module,v
retrieving revision 1.977
diff -u -p -r1.977 node.module
--- modules/node/node.module	17 Sep 2008 20:37:32 -0000	1.977
+++ modules/node/node.module	27 Sep 2008 00:58:24 -0000
@@ -465,8 +465,8 @@ function node_get_types($op = 'types', $
       return $_node_types;
     case 'type':
       return isset($_node_types[$type]) ? $_node_types[$type] : FALSE;
-    case 'module':
-      return isset($_node_types[$type]->module) ? $_node_types[$type]->module : FALSE;
+    case 'base':
+      return isset($_node_types[$type]->base) ? $_node_types[$type]->base : FALSE;
     case 'names':
       return $_node_names;
     case 'name':
@@ -520,18 +520,37 @@ function node_type_save($info) {
   if (empty($info->custom)) {
     $info->custom = 0;
   }
+  if (empty($info->modified)) {
+    $info->modified = 0;
+  }
   if (empty($info->locked)) {
     $info->locked = 0;
   }
+  $fields = array(
+    'type' => $info->type,
+    'name' => $info->name,
+    'base' => $info->base,
+    'has_title' => $info->has_title,
+    'title_label' => $info->title_label,
+    'has_body' => $info->has_body,
+    'body_label' => $info->body_label,
+    'description' => $info->description,
+    'help' => $info->help,
+    'min_word_count' => $info->min_word_count,
+    'custom' => $info->custom,
+    'modified' => $info->modified,
+    'locked' => $info->locked,
+  );
 
   if ($is_existing) {
-    db_query("UPDATE {node_type} SET type = '%s', name = '%s', module = '%s', has_title = %d, title_label = '%s', has_body = %d, body_label = '%s', description = '%s', help = '%s', min_word_count = %d, custom = %d, modified = %d, locked = %d WHERE type = '%s'", $info->type, $info->name, $info->module, $info->has_title, $info->title_label, $info->has_body, $info->body_label, $info->description, $info->help, $info->min_word_count, $info->custom, $info->modified, $info->locked, $existing_type);
+    db_update('node_type')->fields($fields)->condition('type', $existing_type)->execute();
 
     module_invoke_all('node_type', 'update', $info);
     return SAVED_UPDATED;
   }
   else {
-    db_query("INSERT INTO {node_type} (type, name, module, has_title, title_label, has_body, body_label, description, help, min_word_count, custom, modified, locked, orig_type) VALUES ('%s', '%s', '%s', %d, '%s', %d, '%s', '%s', '%s', %d, %d, %d, %d, '%s')", $info->type, $info->name, $info->module, $info->has_title, $info->title_label, $info->has_body, $info->body_label, $info->description, $info->help, $info->min_word_count, $info->custom, $info->modified, $info->locked, $info->orig_type);
+    $fields['orig_type'] = $info->type;
+    db_insert('node_type')->fields($fields)->execute();
 
     module_invoke_all('node_type', 'insert', $info);
     return SAVED_NEW;
@@ -588,8 +607,8 @@ function _node_types_build() {
   while ($type_object = db_fetch_object($type_result)) {
     // Check for node types from disabled modules and mark their types for removal.
     // Types defined by the node module in the database (rather than by a separate
-    // module using hook_node_info) have a module value of 'node'.
-    if ($type_object->module != 'node' && empty($info_array[$type_object->type])) {
+    // module using hook_node_info) have a base value of 'node_content'.
+    if ($type_object->base != 'node_content' && empty($info_array[$type_object->type])) {
       $type_object->disabled = TRUE;
     }
     if (!isset($_node_types[$type_object->type]) || $type_object->modified) {
@@ -659,12 +678,8 @@ function _node_type_set_defaults($info) 
  *   TRUE iff the $hook exists in the node type of $node.
  */
 function node_hook(&$node, $hook) {
-  $module = node_get_types('module', $node);
-  if ($module == 'node') {
-    // Avoid function name collisions.
-    $module = 'node_content';
-  }
-  return module_hook($module, $hook);
+  $base = node_get_types('base', $node);
+  return module_hook($base, $hook);
 }
 
 /**
@@ -681,11 +696,8 @@ function node_hook(&$node, $hook) {
  */
 function node_invoke(&$node, $hook, $a2 = NULL, $a3 = NULL, $a4 = NULL) {
   if (node_hook($node, $hook)) {
-    $module = node_get_types('module', $node);
-    if ($module == 'node') {
-      $module = 'node_content'; // Avoid function name collisions.
-    }
-    $function = $module . '_' . $hook;
+    $base = node_get_types('base', $node);
+    $function = $base . '_' . $hook;
     return ($function($node, $a2, $a3, $a4));
   }
 }
@@ -1171,7 +1183,7 @@ function node_perm() {
   );
 
   foreach (node_get_types() as $type) {
-    if ($type->module == 'node') {
+    if ($type->base == 'node_content') {
       $perms += node_list_permissions($type);
     }
   }
@@ -2086,11 +2098,8 @@ function node_access($op, $node, $accoun
 
   // Can't use node_invoke('access', $node), because the access hook takes the
   // $op parameter before the $node parameter.
-  $module = node_get_types('module', $node);
-  if ($module == 'node') {
-    $module = 'node_content'; // Avoid function name collisions.
-  }
-  $access = module_invoke($module, 'access', $op, $node, $account);
+  $base = node_get_types('base', $node);
+  $access = module_invoke($base, 'access', $op, $node, $account);
   if (!is_null($access)) {
     return $access;
   }
Index: modules/poll/poll.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/poll/poll.module,v
retrieving revision 1.272
diff -u -p -r1.272 poll.module
--- modules/poll/poll.module	17 Sep 2008 07:11:57 -0000	1.272
+++ modules/poll/poll.module	27 Sep 2008 00:58:24 -0000
@@ -174,7 +174,7 @@ function poll_node_info() {
   return array(
     'poll' => array(
       'name' => t('Poll'),
-      'module' => 'poll',
+      'base' => 'poll',
       'description' => t('A <em>poll</em> is a question with a set of possible responses. A <em>poll</em>, once created, automatically provides a simple running count of the number of votes received for each response.'),
       'title_label' => t('Question'),
       'has_body' => FALSE,
Index: modules/taxonomy/taxonomy.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.admin.inc,v
retrieving revision 1.29
diff -u -p -r1.29 taxonomy.admin.inc
--- modules/taxonomy/taxonomy.admin.inc	19 Sep 2008 20:25:03 -0000	1.29
+++ modules/taxonomy/taxonomy.admin.inc	27 Sep 2008 00:58:25 -0000
@@ -747,7 +747,8 @@ function taxonomy_form_term_submit($form
     return;
   }
 
-  switch (taxonomy_save_term($form_state['values'])) {
+  $status = taxonomy_save_term($form_state['values']);
+  switch ($status) {
     case SAVED_NEW:
       drupal_set_message(t('Created new term %term.', array('%term' => $form_state['values']['name'])));
       watchdog('taxonomy', 'Created new term %term.', array('%term' => $form_state['values']['name']), WATCHDOG_NOTICE, l(t('edit'), 'taxonomy/term/' . $form_state['values']['tid'] . '/edit'));
Index: modules/taxonomy/taxonomy.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.module,v
retrieving revision 1.429
diff -u -p -r1.429 taxonomy.module
--- modules/taxonomy/taxonomy.module	24 Sep 2008 18:42:00 -0000	1.429
+++ modules/taxonomy/taxonomy.module	27 Sep 2008 00:58:26 -0000
@@ -320,18 +320,19 @@ function taxonomy_save_term(&$form_value
     'weight' => 0
   );
 
+  $term = (object) $form_values;
+
   if (!empty($form_values['tid']) && $form_values['name']) {
-    drupal_write_record('term_data', $form_values, 'tid');
-    $hook = 'update';
-    $status = SAVED_UPDATED;
+    $status = drupal_write_record('term_data', $form_values, 'tid');
+    module_invoke_all('taxonomy_term_save', $term);
   }
   else if (!empty($form_values['tid'])) {
     return taxonomy_del_term($form_values['tid']);
   }
   else {
-    drupal_write_record('term_data', $form_values);
-    $hook = 'insert';
-    $status = SAVED_NEW;
+    $status = drupal_write_record('term_data', $form_values);
+    $term->tid = $form_values['tid'];
+    module_invoke_all('taxonomy_term_save', $term);
   }
 
   db_query('DELETE FROM {term_relation} WHERE tid1 = %d OR tid2 = %d', $form_values['tid'], $form_values['tid']);
@@ -372,10 +373,6 @@ function taxonomy_save_term(&$form_value
     }
   }
 
-  if (isset($hook)) {
-    module_invoke_all('taxonomy', $hook, 'term', $form_values);
-  }
-
   cache_clear_all();
 
   return $status;
@@ -405,7 +402,7 @@ function taxonomy_del_term($tid) {
         }
       }
 
-      $term = (array) taxonomy_term_load($tid);
+      $term = taxonomy_term_load($tid);
 
       db_query('DELETE FROM {term_data} WHERE tid = %d', $tid);
       db_query('DELETE FROM {term_hierarchy} WHERE tid = %d', $tid);
@@ -413,7 +410,7 @@ function taxonomy_del_term($tid) {
       db_query('DELETE FROM {term_synonym} WHERE tid = %d', $tid);
       db_query('DELETE FROM {term_node} WHERE tid = %d', $tid);
 
-      module_invoke_all('taxonomy', 'delete', 'term', $term);
+      module_invoke_all('taxonomy_term_delete', $term);
     }
 
     $tids = $orphans;
@@ -1048,7 +1045,24 @@ function taxonomy_term_load($tid, $reset
   }
   static $terms = array();
   if (!isset($terms[$tid]) || $reset) {
-    $terms[$tid] = db_fetch_object(db_query('SELECT * FROM {term_data} WHERE tid = %d', $tid));
+    $terms[$tid] = taxonomy_get_term_data($tid, $reset);
+    module_invoke_all('taxonomy_term_load', $terms[$tid]);
+  }
+  return $terms[$tid];
+}
+
+/**
+ * Return a term object from the term_data table.
+ * @param $tid
+ *   A term's ID
+ * @return Object
+ *  A term object. Results are statically cached.
+ */
+function taxonomy_get_term_data($tid, $reset = FALSE) {
+   static $terms = array();
+
+  if (!isset($terms[$tid]) || $reset) {
+    $terms[$tid] = db_query('SELECT * FROM {term_data} WHERE tid = :tid', array(':tid' => $tid))->fetchObject();
   }
   return $terms[$tid];
 }
@@ -1118,7 +1132,7 @@ function taxonomy_select_nodes($tids = a
       $depth = NULL;
     }
     foreach ($tids as $index => $tid) {
-      $term = taxonomy_term_load($tid);
+      $term = taxonomy_get_term_data($tid);
       $tree = taxonomy_get_tree($term->vid, $tid, -1, $depth);
       $descendant_tids[] = array_merge(array($tid), array_map('_taxonomy_get_tid_from_term', $tree));
     }
Index: profiles/default/default.profile
===================================================================
RCS file: /cvs/drupal/drupal/profiles/default/default.profile,v
retrieving revision 1.29
diff -u -p -r1.29 default.profile
--- profiles/default/default.profile	18 Sep 2008 10:44:19 -0000	1.29
+++ profiles/default/default.profile	27 Sep 2008 00:58:26 -0000
@@ -98,7 +98,7 @@ function default_profile_tasks(&$task, $
     array(
       'type' => 'page',
       'name' => st('Page'),
-      'module' => 'node',
+      'base' => 'node_content',
       'description' => st("A <em>page</em>, similar in form to an <em>article</em>, is a simple method for creating and displaying information that rarely changes, such as an \"About us\" section of a website. By default, a <em>page</em> entry does not allow visitor comments and is not featured on the site's initial home page."),
       'custom' => TRUE,
       'modified' => TRUE,
@@ -109,7 +109,7 @@ function default_profile_tasks(&$task, $
     array(
       'type' => 'article',
       'name' => st('Article'),
-      'module' => 'node',
+      'base' => 'node_content',
       'description' => st("An <em>article</em>, similar in form to a <em>page</em>, is ideal for creating and displaying content that informs or engages website visitors. Press releases, site announcements, and informal blog-like entries may all be created with an <em>article</em> entry. By default, an <em>article</em> entry is automatically featured on the site's initial home page, and provides the ability to post comments."),
       'custom' => TRUE,
       'modified' => TRUE,
