You are here

function autoban_advban_uninstall in Automatic IP ban (Autoban) 8

Implements hook_uninstall().

File

modules/autoban_advban/autoban_advban.install, line 11
Install, update and uninstall functions for the Autoban_advban module.

Code

function autoban_advban_uninstall() {

  // Delete autoban entities with advban provider.
  $storage = \Drupal::entityTypeManager()
    ->getStorage('autoban');
  $query = $storage
    ->getQuery();
  $query
    ->condition('provider', [
    'advban',
    'advban_range',
  ], 'IN');
  $entity_ids = $query
    ->execute();
  $entities = $storage
    ->loadMultiple($entity_ids);
  $storage
    ->delete($entities);
}