Problem/Motivation
I am trying to feature module which includes vocabulary configuration and I use default_content to also create the preset terms. In my repeated experiments I notice there is no bulk method to delete al terms, but I thought that deleting the vocabulary would take care of that. (Un)fortunately this is not the case. After re-enabling the feature module I get error messages caused by duplicate UUID. I then looked in the database term table I discover that all terms are still there but orphaned from the now deleted vocabulary. I do not understand the practical advantage of these hidden terms that have become useless, occupy database space and evidently form an obstacle for testing and developping.
Steps to reproduce
- Create a test vocabulary
- Create some terms in the test vocabulary
- Delete the previously created test vocabulary
- Check with database management tool (phpmyadmin) the *term* tables and notice that still terms exist for the test vocabulary
Proposed resolution
Delete vocabulary process should include a step to also delete all its terms. There is already a warning but it should include one about the potential term loss which could include a summary list of the terms to warn users what they are doing.
Comments
Comment #2
pameeela commentedI thought this couldn't be true! It definitely wasn't true in D7, but it does seem to be the case in 8/9.
Comment #3
berdirAccording to \Drupal\taxonomy\Entity\Vocabulary::preDelete(), no that shouldn't happen. What parent value do these leftover terms have, is something wrong with the top level tids detection or does it not delete some childs? Is it a problem with the access check? that doesn't really seem realistic, someone who can delete the vocabulary must have access to the terms? That said, this is not a UI method, it could be called with config import/drush where it might not be an authenticated user.
Comment #6
kristen polThanks for reporting this issue. We rely on issue reports like this one to resolve bugs and improve Drupal core.
As part of the Bug Smash Initiative, we are triaging issues that are marked "Postponed (maintainer needs more info)". This issue was marked "Postponed (maintainer needs more info)" more than a year ago.
Using the steps from the issue summary, I was unable to reproduce the issue. I tested as follows:
Since I couldn't reproduce this issue and this was postponed more than a year ago and has no activity since that time, I'm marking the issue "Closed (cannot reproduce)". If anyone can provide complete steps to reproduce the issue (starting from "Install Drupal core"), document those steps in the issue summary and set the issue status back to "Active".
Thanks!