Upgrading a D6 site with translatable content type(s) to D7.7 yields broken site: node bodies are not displayed at all.

D6 did not support translatable fields, so {field_config}.translatable is always 0, which is good. OTOH affected nodes have $node->field_body[$node->language], which is wrong: they should have $node->field_body[LANGUAGE_NONE] since fields upgraded from D6 are not translatable.

Attached patch solves this by not assigning the $node->language to body values during the upgrade. (We don't have too much upgrade path tests for multi-language sites, if any at all, so @Gábor Hojtsy said on IRC that I don't have to provide tests for this particular case either.)

(Re-posting this as a separate issue from http://drupal.org/node/1164852#comment-4807524 as @Gábor Hojtsy suggested.)

drupal-field_translatable_update-78.patch907 bytesBoobaa
PASSED: [[SimpleTest]]: [MySQL] 35,752 pass(es). View
Members fund testing for the Drupal project. Drupal Association Learn more


Gábor Hojtsy’s picture

Straightforward patch. Devised together with @booba and got confirmation from @plach in IRC that this is right. The docs make it prety clear that this should be the expected behavior (as per http://api.drupal.org/api/drupal/modules--field--field.multilingual.inc/...):

Every field can hold a single or multiple value for each language belonging to the available languages set: For untranslatable fields this set only contains LANGUAGE_NONE.

Since http://drupal.org/node/1164852#comment-4761362 (included in Drupal 7.6/7.7), node bodies are correctly created as not translatable fields in the Drupal 6 to 7 update. However, their values are not properly saved as per the OP above, so the fix there was not complete.

I did not personally test this patch but suggested the change that @booba tested on a dev copy of a production database.

Boobaa’s picture

Yeah, I do have tested it on a dev copy of one of our own sites, with success.

plach’s picture

The patch looks ok, but I don't think @webchick will accept the fact we don't have tests as a good reason to leave this uncovered. if I'm not mistaken we do have a D6 upgrade test for language negotiation options. We might want to check if the DB dump has nodes inside and test node upgrade path too.

Gábor Hojtsy’s picture

@webchick accepted all changes in #1164852: Inconsistencies in field language handling without upgrade tests either, right? The upgrade path right now is more broken than it was before D 7.7, since the previous upgrade path created translatable bodies with the right data (although technically incorrect, it worked), however, now there is a mix of language assignment in Drupal the D6 -> 7.7 upgrade and now the nodes just don't have a visible node body in the upgrade. I do agree it would be great to have upgrade tests for multilingual sites, and this bug might be the turning point for that (in an "OMG we still have not fixed this, we need tests for this ASAP" kind of way), just pointing out what happened so far.

sun’s picture

Status: Needs review » Closed (duplicate)

Sorry, but I really think that we should keep this in #1164852: Inconsistencies in field language handling

We need to do proper update + upgrade path tests on that issue either way, and all of the functional changes to field languages have been done over there.