Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleting items leaves orphaned data behind #1845

Open
pedro-mendonca opened this issue May 15, 2024 · 0 comments · May be fixed by #1846
Open

Deleting items leaves orphaned data behind #1845

pedro-mendonca opened this issue May 15, 2024 · 0 comments · May be fixed by #1846
Assignees
Labels
[Type] Bug An existing feature is broken.

Comments

@pedro-mendonca
Copy link
Member

Description

When a user deletes different types of items, many orphaned data is left behind, forever.

This happens because years ago the codebase moved from a foreach delete() for each child to a delete_many() aproach, that is faster but doesn't delete child items.

One can only imagine the ammout of orphaned data out there! :)

Cases:

  1. Delete Glossary: Doesn't delete Glossary entries!
  2. Delete Translation Set: Doesn't delete its Glossary or entries!
  3. Delete Project: Doesn't delete Project translations, Glossaries or entries!

Step-by-step reproduction instructions

  1. Create a Project, import originals, add a Translation Set, Translations, a Glossary with some entries.
  2. Delete a translation set that has translations.
  3. Check the database, see the orphaned glossary and for the inexistent Translation Set.
  4. Delete a glossary.
  5. Check the database, see the orphaned glossary entries for the inexistent Glossary.
  6. Make sure the project has all the above data again.
  7. Delete the Project.
  8. Check the database for orphaned translations, glossaries and glossary entries.

If you don't have an easy access to the DB data, you can use GP Toolbox to quickly test the orphaned data just created.

Expected behavior

On deleting an item, it's expected to delete any child items.
Examples:

  1. Delete Project
    • Delete Originals
    • Delete Translation Sets
    • Delete Translations
    • Delete project Glossaries
    • Delete project Glossary Entries
  2. Delete Translation Set
    • Delete Translations
    • Delete project Glossary
    • Delete project Glossary Entries
  3. Delete project Glossary
    • Delete project Glossary Entries

Actual behavior

  1. Delete Glossary: Doesn't delete Glossary entries!
  2. Delete Translation Set: Doesn't delete its Glossary or entries!
  3. Delete Project: Doesn't delete Project translations, Glossaries or entries!

Note

Might be usefull to add a wp-cli to quickly get and delete orphaned data for old and big GlotPress databases.

@pedro-mendonca pedro-mendonca added the [Type] Bug An existing feature is broken. label May 15, 2024
@pedro-mendonca pedro-mendonca self-assigned this May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug An existing feature is broken.
Projects
None yet
1 participant