You are here

function acquia_search_disable_revert_defaults in Acquia Connector 7.2

Helper function to revert the default environment after disable

1 call to acquia_search_disable_revert_defaults()
acquia_search_disable in acquia_search/acquia_search.module
Implementation of hook_disable().

File

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

Code

function acquia_search_disable_revert_defaults() {

  // if the environment does not exists, it will return FALSE
  // Clear all caches to be sure.
  cache_clear_all('apachesolr:environments', 'cache_apachesolr');
  drupal_static_reset('apachesolr_load_all_environments');
  drupal_static_reset('apachesolr_get_solr');
  if (module_exists('ctools')) {
    ctools_include('export');
    ctools_export_load_object_reset('apachesolr_environment');
  }
  if (!apachesolr_environment_load('solr')) {
    module_load_include('inc', 'apachesolr', 'apachesolr.index');

    // Same statements as during the apachesolr install process
    // @todo make this less duplicate
    db_insert('apachesolr_environment')
      ->fields(array(
      'env_id' => 'solr',
      'name' => 'localhost server',
      'url' => 'http://localhost:8983/solr',
    ))
      ->execute();

    // Initialize the entities to index. We enable all node types by default
    $info = entity_get_info('node');
    $bundles = array_keys($info['bundles']);
    apachesolr_index_set_bundles('solr', 'node', $bundles);
  }

  // Go back to the default variable which is 'solr'.
  variable_del('apachesolr_default_environment');
}