You are here

function search_api_search_api_server_delete in Search API 7

Implements hook_search_api_server_delete().

Calls the preDelete() method for the server.

1 string reference to 'search_api_search_api_server_delete'
search_api_search_api_server_insert in ./search_api.module
Implements hook_search_api_server_insert().

File

./search_api.module, line 629
Provides a flexible framework for implementing search services.

Code

function search_api_search_api_server_delete(SearchApiServer $server) {

  // Only react on real delete, not revert.
  if ($server
    ->hasStatus(ENTITY_IN_CODE)) {
    $reverts =& drupal_static(__FUNCTION__, array());
    $reverts[$server->machine_name] = $server;
    return;
  }
  $server
    ->preDelete();
  foreach (search_api_index_load_multiple(FALSE, array(
    'server' => $server->machine_name,
  )) as $index) {
    $index
      ->update(array(
      'server' => NULL,
      'enabled' => FALSE,
    ));
  }
  search_api_server_tasks_delete(NULL, $server);
}