You are here

function apachesolr_node_type_delete in Apache Solr Search 8

Same name and namespace in other branches
  1. 7 apachesolr.module \apachesolr_node_type_delete()

Implements hook_node_type_delete().

File

./apachesolr.module, line 730
Integration with the Apache Solr search application.

Code

function apachesolr_node_type_delete($info) {
  module_load_include('inc', 'apachesolr', 'apachesolr.index');
  $env_id = apachesolr_default_environment();
  $existing_bundles = apachesolr_get_index_bundles($env_id, 'node');
  $new_bundles = $existing_bundles;
  $index = array_search($info->type, $existing_bundles);
  if ($index !== FALSE) {
    unset($new_bundles[$index]);
    $new_bundles = array_values($new_bundles);
    apachesolr_index_set_bundles($env_id, 'node', $new_bundles);
  }
  apachesolr_index_delete_bundles($env_id, 'node', array(
    $info->type,
  ));
  $callback = apachesolr_entity_get_callback('node', 'bundles changed callback');
  if (!empty($callback)) {
    call_user_func($callback, $env_id, $existing_bundles, $new_bundles);
  }
  apachesolr_environments_clear_cache();
}