You are here

function search_api_server_tasks_add in Search API 7

Adds an entry into a server's list of pending tasks.

Parameters

SearchApiServer $server: The server for which a task should be remembered.

$type: The type of task to perform.

SearchApiIndex|string|null $index: (optional) If applicable, the index to which the task pertains (or its machine name).

mixed $data: (optional) If applicable, some further data necessary for the task.

5 calls to search_api_server_tasks_add()
SearchApiServer::addIndex in includes/server_entity.inc
Adds a new index to this server.
SearchApiServer::deleteItems in includes/server_entity.inc
Deletes indexed items from this server.
SearchApiServer::fieldsUpdated in includes/server_entity.inc
Notifies the server that the field settings for the index have changed.
SearchApiServer::removeIndex in includes/server_entity.inc
Removes an index from this server.
SearchApiWebTest::deleteServer in ./search_api.test
Tests whether deleting the server works correctly.

File

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

Code

function search_api_server_tasks_add(SearchApiServer $server, $type, $index = NULL, $data = NULL) {
  db_insert('search_api_task')
    ->fields(array(
    'server_id' => $server->machine_name,
    'type' => $type,
    'index_id' => $index ? is_object($index) ? $index->machine_name : $index : NULL,
    'data' => isset($data) ? serialize($data) : NULL,
  ))
    ->execute();
}