You are here

function acquia_search_disable in Acquia Search 6.3

Same name and namespace in other branches
  1. 6 acquia_search.module \acquia_search_disable()

Implementation of hook_disable().

Helper function to clear variables we may have set.

1 call to acquia_search_disable()
acquia_search_acquia_subscription_status in ./acquia_search.module
Implementation of hook_acquia_subscription_status().

File

./acquia_search.module, line 66
Integration between Acquia Drupal and Acquia's hosted solr search service.

Code

function acquia_search_disable() {

  // Remove the environment we added.
  apachesolr_environment_delete(ACQUIA_SEARCH_ENVIRONMENT_ID);

  // Unset all other acquia search environments
  $environments = apachesolr_load_all_environments($reset = TRUE);
  foreach ($environments as $environment) {
    if (acquia_search_environment_connected($environment)) {

      // remove traces of acquia_search
      // unset our acquia url and set it back to default
      $environment['url'] = 'http://localhost:8983/solr';
      if (apachesolr_default_environment() == $environment['env_id']) {

        // Go back to the default.
        variable_del('apachesolr_default_environment');
      }

      // Emptying the service class, unsetting it would not work, since it would
      // not overwrite the old value
      $environment['service_class'] = '';
      if (is_array($environment['conf'])) {
        $environment['conf']['service_class'] = '';
      }
      apachesolr_environment_save($environment);
    }
  }
  variable_del('acquia_search_derived_key_salt');
}