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 new L10nServerReleaseStorage::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

gábor hojtsy created an issue. See original summary.

  • a153cfa9 committed on 7.x-1.x
    fix #3621577: Deleting a project or release leaves its releases, files,...

  • deadf5b7 committed on 3.0.x
    fix #3621577: Deleting a project or release leaves its releases, files,...
gábor hojtsy’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.