You are here

function acquia_search_disable in Acquia Connector 7

Same name and namespace in other branches
  1. 7.3 acquia_search/acquia_search.install \acquia_search_disable()
  2. 7.2 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 80
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();
  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 (variable_get('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'] = '';
      apachesolr_environment_save($environment);
    }
  }
}