You are here

function elasticsearch_watchdog_uninstall in Elasticsearch Connector 7.5

Same name and namespace in other branches
  1. 7 modules/elasticsearch_watchdog/elasticsearch_watchdog.install \elasticsearch_watchdog_uninstall()
  2. 7.2 modules/elasticsearch_watchdog/elasticsearch_watchdog.install \elasticsearch_watchdog_uninstall()

Implements hook_uninstall().

File

modules/elasticsearch_watchdog/elasticsearch_watchdog.install, line 11
Created on Jan 08, 2014

Code

function elasticsearch_watchdog_uninstall() {
  if (!module_exists('elasticsearch_connector')) {
    module_load_include('module', 'elasticsearch_connector');
  }
  module_load_include('module', 'elasticsearch_watchdog');
  $client_id = elasticsearch_watchdog_get_cluster_id();
  if (!empty($client_id)) {
    $client = elasticsearch_connector_get_client_by_id($client_id);
    if ($client) {
      $index = elasticsearch_watchdog_get_index_name();
      try {
        $client
          ->indices()
          ->delete(array(
          'index' => $index,
        ));
      } catch (Exception $e) {
      }
    }
  }
  variable_del('elasticsearch_watchdog_cluster_id');
  variable_del('elasticsearch_watchdog_view_additional_indexes');
}