Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295813

Deleting a translation leaves behind orphaned revisions

$
0
0

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.

  1. Steps to reproduce:
  2. Install Standard profile in enlgish and enable content_translation module
  3. Add a language (for example French) (admin/config/regional/language)
  4. Enable content translation of article bundles (admin/config/regional/content-language)
  5. 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)
    
  6. 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)
    
  7. 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)
    
  8. 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)
    
  9. 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)
    
  10. 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.
  11. 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.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes


Viewing all articles
Browse latest Browse all 295813

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>