You are here

function apachesolr_clear_cache in Apache Solr Search 8

Same name and namespace in other branches
  1. 6.3 apachesolr.module \apachesolr_clear_cache()
  2. 6 apachesolr.module \apachesolr_clear_cache()
  3. 6.2 apachesolr.module \apachesolr_clear_cache()
  4. 7 apachesolr.module \apachesolr_clear_cache()

A wrapper for cache_clear_all to be used as a submit handler on forms that require clearing Luke cache etc.

3 string references to 'apachesolr_clear_cache'
apachesolr_form_field_ui_field_edit_form_alter in ./apachesolr.module
Implements hook_form_[form_id]_alter(). (D7)
apachesolr_form_field_ui_field_overview_form_alter in ./apachesolr.module
Implements hook_form_[form_id]_alter(). (D7)
apachesolr_form_node_type_form_alter in ./apachesolr.module
Implements hook_form_[form_id]_alter().

File

./apachesolr.module, line 853
Integration with the Apache Solr search application.

Code

function apachesolr_clear_cache($env_id) {

  // Reset $env_id to NULL if call originates from a form submit handler.
  if (is_array($env_id)) {
    $env_id = NULL;
  }
  try {
    $solr = apachesolr_get_solr($env_id);
    $solr
      ->clearCache();
  } catch (Exception $e) {
    watchdog('Apache Solr', nl2br(check_plain($e
      ->getMessage())), NULL, WATCHDOG_ERROR);
    drupal_set_message(nl2br(check_plain($e
      ->getMessage())), 'warning');
  }
}