summaryrefslogtreecommitdiff
path: root/modules/node/node.install
diff options
context:
space:
mode:
Diffstat (limited to 'modules/node/node.install')
-rw-r--r--modules/node/node.install16
1 files changed, 15 insertions, 1 deletions
diff --git a/modules/node/node.install b/modules/node/node.install
index 81ad93b3e..e51e7f15c 100644
--- a/modules/node/node.install
+++ b/modules/node/node.install
@@ -512,10 +512,24 @@ function node_update_7006(&$sandbox) {
$result = db_select('node_type', 'node_type')
->fields('node_type')
->execute();
+ foreach ($result as $type_object) {
+ $node_types[$type_object->type] = $type_object;
+ }
+ $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;
+ }
$default_trim_length = variable_get('teaser_length', 600);
// Add body field instances for existing node types.
- foreach ($result as $node_type) {
+ foreach ($node_types as $node_type) {
if ($node_type->has_body) {
$instance = node_add_body_field($node_type, $node_type->body_label);
// Update newly created instance to convert teaser_length variable