diff --git a/modules/node/node.install b/modules/node/node.install index 4be27cb..a94cbbc 100644 --- a/modules/node/node.install +++ b/modules/node/node.install @@ -442,7 +442,21 @@ function node_update_dependencies() { * @ingroup update-api-6.x-to-7.x */ function _update_7000_node_get_types() { - return db_query('SELECT * FROM {node_type}')->fetchAllAssoc('type', PDO::FETCH_OBJ); + $node_types = db_query('SELECT * FROM {node_type}')->fetchAllAssoc('type', PDO::FETCH_OBJ); + + // 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; + } + return $node_types; } /**