You are here

function search_api_server_tasks_delete in Search API 7

Removes pending server tasks from the list.

Parameters

array|null $ids: (optional) The IDs of the pending server tasks to delete. Set to NULL to not filter by IDs.

SearchApiServer|null $server: (optional) A server for which the tasks should be deleted. Set to NULL to delete tasks from all servers.

SearchApiIndex|string|null $index: (optional) An index (or its machine name) for which the tasks should be deleted. Set to NULL to delete tasks for all indexes.

3 calls to search_api_server_tasks_delete()
SearchApiServer::removeIndex in includes/server_entity.inc
Removes an index from this server.
search_api_search_api_server_delete in ./search_api.module
Implements hook_search_api_server_delete().
search_api_server_tasks_check in ./search_api.module
Checks for pending tasks on one or all enabled search servers.

File

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

Code

function search_api_server_tasks_delete(array $ids = NULL, SearchApiServer $server = NULL, $index = NULL) {
  $delete = db_delete('search_api_task');
  if ($ids) {
    $delete
      ->condition('id', $ids);
  }
  if ($server) {
    $delete
      ->condition('server_id', $server->machine_name);
  }
  if ($index) {
    $delete
      ->condition('index_id', $index->machine_name);
  }
  $delete
    ->execute();
}