Problem/Motivation
Deleting a translation leaves behind orphaned revisions that can never be retrieved using the UI. The easiest way to describe the problem is to read the steps to reproduce that show the content of the node_field_revision table.
- Steps to reproduce:
- Install Standard profile in enlgish and enable content_translation module
- Add a language (for example French) (admin/config/regional/language)
- Enable content translation of article bundles (admin/config/regional/content-language)
- Create an English article
mysql> select nid, vid, langcode from node_field_revision; +-----+-----+----------+ | nid | vid | langcode | +-----+-----+----------+ | 2 | 6 | en | +-----+-----+----------+ 1 row in set (0.00 sec)
- Edit the edit english article (you now have 2 revisions)
mysql> select nid, vid, langcode from node_field_revision; +-----+-----+----------+ | nid | vid | langcode | +-----+-----+----------+ | 2 | 6 | en | | 2 | 7 | en | +-----+-----+----------+ 2 rows in set (0.00 sec)
- Create a french translation
mysql> select nid, vid, langcode from node_field_revision; +-----+-----+----------+ | nid | vid | langcode | +-----+-----+----------+ | 2 | 8 | fr | | 2 | 6 | en | | 2 | 7 | en | | 2 | 8 | en | +-----+-----+----------+ 4 rows in set (0.01 sec)
- Edit the english node
mysql> select nid, vid, langcode from node_field_revision; +-----+-----+----------+ | nid | vid | langcode | +-----+-----+----------+ | 2 | 8 | fr | | 2 | 9 | fr | | 2 | 6 | en | | 2 | 7 | en | | 2 | 8 | en | | 2 | 9 | en | +-----+-----+----------+ 6 rows in set (0.00 sec)
- Delete the french tranlation
mysql> select nid, vid, langcode from node_field_revision; +-----+-----+----------+ | nid | vid | langcode | +-----+-----+----------+ | 2 | 8 | fr | | 2 | 6 | en | | 2 | 7 | en | | 2 | 8 | en | | 2 | 9 | en | +-----+-----+----------+ 5 rows in set (0.00 sec)
- At this point:
- although we have a row for a french translation the node is showing as untranslated on node/2/translations
- And on the revisions tab you can only revert to revision 6 & 7.
- Hacking the URL to revert to revision 8... does magic and the french translation appears again...
mysql> select nid, vid, langcode from node_field_revision; +-----+-----+----------+ | nid | vid | langcode | +-----+-----+----------+ | 2 | 8 | fr | | 2 | 10 | fr | | 2 | 6 | en | | 2 | 7 | en | | 2 | 8 | en | | 2 | 9 | en | | 2 | 10 | en | +-----+-----+----------+ 7 rows in set (0.00 sec)
We need decide what the expected behaviour should be. i don't think deleting the current translation revision is the expected behaviour. It is a halfway house between removing all revisions that pertain to the translation and just creating a new revision without the translation.
Discovered whilst working on #1239558: Deleting an entity with revisions and file/image field does not release file usage of non-default revisions, causing files to linger.