diff --git a/core/modules/field/field.crud.inc b/core/modules/field/field.crud.inc index b8e2015..14e8b6c 100644 --- a/core/modules/field/field.crud.inc +++ b/core/modules/field/field.crud.inc @@ -886,10 +886,18 @@ function field_purge_batch($batch_size) { // field_purge_data() will need the field array. $field = field_info_field_by_id($instance['field_id']); // Retrieve some entities. - $results = $factory->get($entity_type) - ->condition('id:' . $field['id'] . '.deleted', 1) - ->condition($info[$entity_type]['entity_keys']['bundle'], $ids->bundle) - ->range(0, $batch_size) + $query = $factory->get($entity_type) + ->condition('id:' . $field['id'] . '.deleted', 1); + // Special treatment is required for {taxonomy_term} table as there is no + // vocabulary_machine_name field in the {taxonomy_term} table. + if ($entity_type == 'taxonomy_term') { + $query->condition('vid', taxonomy_vocabulary_machine_name_load($ids->bundle)->vid); + } + else { + $query->condition($info[$entity_type]['entity_keys']['bundle'], $ids->bundle); + } + + $results = $query->range(0, $batch_size) ->execute(); if ($results) { diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php b/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php index 5c95351..705025e 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php @@ -367,7 +367,7 @@ function testDeleteTaxonomyField() { $this->fieldUIAddNewField($bundle_path, $edit1); // Delete the field. - $this->fieldUIDeleteField($bundle_path, $this->field_name, $this->field_label, 'tags'); + $this->fieldUIDeleteField($bundle_path, $this->field_name, $this->field_label, 'Tags'); // Reset the fields info. field_info_cache_clear();