Problem/Motivation
At present Revision Manager calculates number of revisions to keep cumulatively for all languages enabled on the site. it produces inadequate results for entities with multiple translations available.
Scenario: node has 2 translations in addition to the original language, 3 all together. Each translation has its own revisions, when Revision Manager is calculating what to remove it keeps let's say 10 latest revisions for all three languages counted together. So, original language can have 6 revisions kept, one translation 3 revisions and another translation only a single revision left because it wasn't touched for a while.
Expected behavior would be that RM leaves 10 last revisions for each translation.
Proposed resolution
Change algorithm so it keeps configured number of revisions PER TRANSLATION, instead of the current "per entity" logic.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 3561769-add-support-for-multilingual-4.patch | 9.5 KB | j-barnes |
Issue fork revision_manager-3561769
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
j-barnes commentedThanks for writing this up, was super helpful.
I added a MR and will post a patch as well. Revisions are now counted per translation using
revision_translation_affectedinstead of cumulatively across the entity. Added some multilingual tests to cover the behavior.Going to get our internal team to test it out early next week. If you get a chance to try it on your setup before then let me know how it goes.
Comment #5
jura.khrapunov commentedIt seems it does the job nicely! I've tested it on the real database and now versions are preserved per-language which is exactly what we wanted.
Kudos, @j-barnes, thanks for the swift turnaround.
Comment #6
sunny-lee commentedThis looks great! I also tested on our sites with Spanish and Korean, and successfully kept the set number of revisions (5) for each of these languages separately from English. So instead of 5 total for all 3, there are 15, 5 for each language. Created a new media entity and tried with that as well with success.
Comment #8
j-barnes commentedThanks everyone for the help on this!