You are here

function acquia_search_disable in Acquia Connector 7.2

Same name and namespace in other branches
  1. 7.3 acquia_search/acquia_search.install \acquia_search_disable()
  2. 7 acquia_search/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/acquia_search.module
Implementation of hook_acquia_subscription_status().

File

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

Code

function acquia_search_disable() {

  // Revert the default search environment
  if (apachesolr_default_environment() == ACQUIA_SEARCH_ENVIRONMENT_ID) {
    acquia_search_disable_revert_defaults();
  }

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

  // Unset all other acquia search environments
  $environments = apachesolr_load_all_environments();
  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';

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