summaryrefslogtreecommitdiff
path: root/modules/node/node.install
diff options
context:
space:
mode:
authorwebchick <webchick@24967.no-reply.drupal.org>2011-05-13 11:30:57 -0400
committerwebchick <webchick@24967.no-reply.drupal.org>2011-05-13 11:30:57 -0400
commit78f5ec5472c5893a44ac9ffd6b03e8af9c8dff44 (patch)
tree5caa16b0b358be86604ded17a408b9484641e336 /modules/node/node.install
parentb1bd7f76152725a976059e27f5cf3ed8acb0a627 (diff)
downloadbrdo-78f5ec5472c5893a44ac9ffd6b03e8af9c8dff44.tar.gz
brdo-78f5ec5472c5893a44ac9ffd6b03e8af9c8dff44.tar.bz2
Hm. Rollback of previous patch. I think I just broke testbot. NOOB.
Diffstat (limited to 'modules/node/node.install')
-rw-r--r--modules/node/node.install34
1 files changed, 14 insertions, 20 deletions
diff --git a/modules/node/node.install b/modules/node/node.install
index 14290e3ad..c5378dc85 100644
--- a/modules/node/node.install
+++ b/modules/node/node.install
@@ -469,26 +469,7 @@ function node_update_dependencies() {
* @ingroup update-api-6.x-to-7.x
*/
function _update_7000_node_get_types() {
- $node_types = db_query('SELECT * FROM {node_type}')->fetchAllAssoc('type', PDO::FETCH_OBJ);
-
- // Create default settings for orphan nodes.
- $all_types = db_query('SELECT DISTINCT type FROM {node}')->fetchCol();
- $extra_types = array_diff($all_types, array_keys($node_types));
-
- foreach ($extra_types as $type) {
- $type_object = new stdClass;
- $type_object->type = $type;
-
- // In Drupal 6, whether you have a body field or not is a flag in the node
- // type table. If it's enabled, nodes may or may not have an empty string
- // for the bodies. As we can't detect what this setting should be in
- // Drupal 7 without access to the Drupal 6 node type settings, we assume
- // the default, which is to enable the body field.
- $type_object->has_body = 1;
- $type_object->body_label = 'Body';
- $node_types[$type_object->type] = $type_object;
- }
- return $node_types;
+ return db_query('SELECT * FROM {node_type}')->fetchAllAssoc('type', PDO::FETCH_OBJ);
}
/**
@@ -619,6 +600,19 @@ function node_update_7006(&$sandbox) {
// Get node type info, specifically the body field settings.
$node_types = _update_7000_node_get_types();
+ // Create default settings for orphan nodes.
+ $extra_types = db_query('SELECT DISTINCT type FROM {node} WHERE type NOT IN (:types)', array(':types' => array_keys($node_types)))->fetchCol();
+ foreach ($extra_types as $type) {
+ $type_object = new stdClass;
+ $type_object->type = $type;
+ // Always create a body. Querying node_revisions for a non-empty body
+ // would skip creating body fields for types that have a body but
+ // the nodes of that type so far had empty bodies.
+ $type_object->has_body = 1;
+ $type_object->body_label = 'Body';
+ $node_types[$type_object->type] = $type_object;
+ }
+
// Add body field instances for existing node types.
foreach ($node_types as $node_type) {
if ($node_type->has_body) {