summaryrefslogtreecommitdiff
path: root/modules/node/node.install
diff options
context:
space:
mode:
authorwebchick <webchick@24967.no-reply.drupal.org>2011-08-23 23:39:37 +0100
committerwebchick <webchick@24967.no-reply.drupal.org>2011-08-23 23:39:37 +0100
commit23c31ac7141f3d8be913705ae269b22187623d98 (patch)
tree4d465518e085aae12c938c3aac59395cc48526c6 /modules/node/node.install
parentcf9c0729fa3620669c99e5675192399f32824852 (diff)
downloadbrdo-23c31ac7141f3d8be913705ae269b22187623d98.tar.gz
brdo-23c31ac7141f3d8be913705ae269b22187623d98.tar.bz2
Issue #1164852 follow-up by plach, chx, Boobaa, sun: Fixed critical regression: Node bodies display as empty after upgrade to 7.7 from 6.x if the nodes have a language.
Diffstat (limited to 'modules/node/node.install')
-rw-r--r--modules/node/node.install33
1 files changed, 33 insertions, 0 deletions
diff --git a/modules/node/node.install b/modules/node/node.install
index d33f095f0..a1f77bb0f 100644
--- a/modules/node/node.install
+++ b/modules/node/node.install
@@ -616,6 +616,7 @@ function node_update_7006(&$sandbox) {
'module' => 'text',
'cardinality' => 1,
'entity_types' => array('node'),
+ 'translatable' => TRUE,
);
_update_7000_field_create_field($body_field);
@@ -867,5 +868,37 @@ function node_update_7011() {
}
/**
+ * Switches body fields to untranslatable while upgrading from D6 and makes them language neutral.
+ */
+function node_update_7012() {
+ // If we are upgrading from D6, then body fields should be set back to
+ // untranslatable, as D6 did not know about the idea of translating fields,
+ // but only nodes. If a D7 > D7 update is running we need to skip this update,
+ // as it is a valid use case to have translatable body fields in this context.
+ if (variable_get('update_d6', FALSE)) {
+ // Make node bodies untranslatable: field_update_field() cannot be used
+ // throughout the upgrade process and we do not have an update counterpart
+ // for _update_7000_field_create_field(). Hence we are forced to update the
+ // 'field_config' table directly. This is a safe operation since it is
+ // being performed while upgrading from D6. Perfoming the same operation
+ // during a D7 update is highly discouraged.
+ db_update('field_config')
+ ->fields(array('translatable' => 0))
+ ->condition('field_name', 'body')
+ ->execute();
+
+ // Switch field languages to LANGUAGE_NONE, since initially they were
+ // assigned $node->language.
+ foreach (array('field_data_body', 'field_revision_body') as $table) {
+ db_update($table)
+ ->fields(array('language' => LANGUAGE_NONE))
+ ->execute();
+ }
+
+ node_type_cache_reset();
+ }
+}
+
+/**
* @} End of "addtogroup updates-6.x-to-7.x"
*/