Commit c26a85ea authored by catch's avatar catch
Browse files

Issue #2343517 by joelpittet, quietone, rteijeiro, andypost: Cleanup @todo...

Issue #2343517 by joelpittet, quietone, rteijeiro, andypost: Cleanup @todo referring to the config dependencies API issue
parent 462b3b7a
Loading
Loading
Loading
Loading
+0 −15
Original line number Diff line number Diff line
@@ -81,14 +81,6 @@ function field_purge_batch($batch_size, $field_storage_unique_id = NULL) {
  foreach ($fields as $field) {
    $entity_type = $field->getTargetEntityTypeId();

    // We cannot purge anything if the entity type is unknown (e.g. the
    // providing module was uninstalled).
    // @todo Revisit after https://www.drupal.org/node/2080823.
    if (!isset($info[$entity_type])) {
      \Drupal::logger('field')->warning("Cannot remove field @field_name because the entity type is unknown: %entity_type", ['@field_name' => $field->getName(), '%entity_type' => $entity_type]);
      continue;
    }

    $count_purged = \Drupal::entityTypeManager()->getStorage($entity_type)->purgeFieldData($field, $batch_size);
    if ($count_purged < $batch_size || $count_purged == 0) {
      // No field data remains for the field, so we can remove it.
@@ -108,13 +100,6 @@ function field_purge_batch($batch_size, $field_storage_unique_id = NULL) {
      continue;
    }

    // We cannot purge anything if the entity type is unknown (e.g. the
    // providing module was uninstalled).
    // @todo Revisit after https://www.drupal.org/node/2080823.
    if (!isset($info[$field_storage->getTargetEntityTypeId()])) {
      continue;
    }

    $fields = $deleted_fields_repository->getFieldDefinitions($field_storage->getUniqueStorageIdentifier());
    if (empty($fields)) {
      field_purge_field_storage($field_storage);