You are here

function drush_taxonomy_entity_index_rebuild in Taxonomy Entity Index 8

Same name and namespace in other branches
  1. 7 taxonomy_entity_index.drush.inc \drush_taxonomy_entity_index_rebuild()

Rebuilds the taxonomy entity index.

File

./taxonomy_entity_index.drush.inc, line 34
Drush integration for taxonomy_entity_index.

Code

function drush_taxonomy_entity_index_rebuild() {
  $operations = [];
  $entity_types = drush_get_option('entity_types');
  if (empty($entity_types)) {
    $entity_types = array_keys(\Drupal::entityTypeManager()
      ->getDefinitions());
  }
  else {
    $entity_types = explode(',', $entity_types);
  }
  foreach ($entity_types as $type) {
    $operations[] = [
      'taxonomy_entity_index_reindex_entity_type',
      [
        $type,
      ],
    ];
  }
  $batch = [
    'operations' => $operations,
    'finished' => 'taxonomy_entity_index_finished',
  ];
  batch_set($batch);

  // Process the batch.
  $batch =& batch_get();
  $batch['progressive'] = FALSE;
  batch_process();
}