Affects Version/s: 1.13.0, 2.0.0
Component/s: Platform > Repository & Services (Public API impl)
Duplicate of https://jira.ez.no/browse/EZEE-1897, I created that on in the wrong project.
In ezpublish-kernel version v6.13.0 in eZ/Publish/Core/Persistence/Legacy/Content/UrlAlias/Gateway/DoctrineDatabase.php the function loadLocationEntriesMatchingMultipleLanguages() uses a wrong query. The second where() overwrites the first one, so no locationID filter is applied to the query.
This causes problem in archiveUrlAliasesForDeletedTranslations(), because it will "archive" items it really shouldn't: all the ones that have a translation in the language it was passed to it.
Step to reproduce:
1. Have a page with 3 languages (in our case DE, FR, IT)
2. Have a few contents that have IT translation (just to see what will be messed up)
3. Create a content in DE
4. Translate it to FR
5. Translate it to IT
6. On Versions tab select the one that has only DE and FR versions and click "New draft based on selected version".
7. Publish the content
All the ezurlalias_ml records that have IT language in the lang_mask will be historized with new "link" value that points to the ID the removed language version had in the table (and the other two language version still have)
The result is that the Italian version doesn't have nice URL's only /it/it/view/content/262/full/1/273 ones, goes to 404 too because it has /it twice.
The code was commited to the repository here: https://github.com/ezsystems/ezpublish-kernel/commit/0ff5001b8f4626d7774e4caa4861e71034e1c927