You are here

function system_update_8008 in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/system.install \system_update_8008()

Purge field schema data for uninstalled entity types.

File

core/modules/system/system.install, line 1654
Install, update and uninstall functions for the system module.

Code

function system_update_8008() {
  $entity_types = \Drupal::entityManager()
    ->getDefinitions();

  /** @var \Drupal\Core\KeyValueStore\KeyValueStoreInterface $schema */
  $schema = \Drupal::keyValue('entity.storage_schema.sql');
  foreach ($schema
    ->getAll() as $key => $item) {
    list($entity_type_id, , ) = explode('.', $key);
    if (!isset($entity_types[$entity_type_id])) {
      $schema
        ->delete($key);
    }
  }
}