Problem/Motivation
On Drupal 7, l10n_server_delete_project() and l10n_server_delete_release() delete the parsing errors, lines, files and releases that belong to what is deleted, and then the orphan source strings with their translations and status flags (l10n_server_delete_orphans()). Translation history is kept. The confirm forms warn about exactly that.
On 3.0.x both entity types use the plain ContentEntityDeleteForm and nothing implements a delete hook, so deleting a project removes only the project row. Its releases, files, lines and errors stay behind pointing at a dead pid, and strings that no release uses any more are never cleaned up. Same for a release.
Steps to reproduce
Proposed resolution
L10nServerRelease::preDelete()drops the files, lines and errors of the deleted releases through a newL10nServerReleaseStorage::deleteParsedData(), shared with start over;postDelete()runs the orphan cleanup once per delete call.L10nServerProject::preDelete()deletes the releases of the project through the entity API, so the release cascade does the rest.- Project start over deletes the release rows directly instead of through the entity API, since it keeps the orphan strings on purpose like Drupal 7.
- Both delete forms get the Drupal 7 warning text about what goes away.
Tests
Drupal 7 first: L10nServerDeleteTestCase::testDeleteCascade() builds two projects with three releases sharing one string, deletes a release and then a project through the admin confirm forms, and checks what stays and what goes, including that translation history is kept. Ported as DeleteCascadeTest (kernel), which also checks that project start over keeps the strings.
Remaining tasks
User interface changes
API changes
Data model changes
LLM disclosure
LLM was used to find, diagnose explain and fix this issue. With human review.
Comments
Comment #4
gábor hojtsy