Deleting a vocabulary will fail when there are lots of terms

Created on 26 October 2023, 11 months ago

Problem/Motivation

Discovered via 🌱 Configuration change data loss prevention functionality inconsistent, restrictive Active .

  public static function preDelete(EntityStorageInterface $storage, array       $entities) {
    parent::preDelete($storage, $entities);

    // Only load terms without a parent, child terms will get deleted too.
    $term_storage = \Drupal::entityTypeManager()->getStorage('taxonomy_term');
    $terms = $term_storage->loadMultiple($storage-                              >getToplevelTids(array_keys($entities)));
    $term_storage->delete($terms);
  }

When there are lots of terms, this is going to run out of memory.

Steps to reproduce

Proposed resolution

Add the same kind of handling as node types:

Example is used by 1 piece of content on your site. You can not remove this content type until you have removed all of the
Example content."

Eventually, we could add the option to delete all too, but that would have to be done in a queue/batch and should be implemented generically for all content entities.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component
TaxonomyΒ  β†’

Last updated 1 day ago

  • Maintained by
  • πŸ‡ΊπŸ‡ΈUnited States @xjm
  • πŸ‡¬πŸ‡§United Kingdom @catch
Created by

πŸ‡¬πŸ‡§United Kingdom catch

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024