function search_api_drush_get_server in Search API 7
Returns a server or all servers as an array.
Parameters
string|int|null $server_id: (optional) The ID or machine name of the server to load. Defaults to loading all available servers.
Return value
SearchApiServer[] An array of servers.
2 calls to search_api_drush_get_server()
- drush_search_api_execute_tasks in ./
search_api.drush.inc - Execute all pending tasks or all for a given server.
- drush_search_api_set_index_server in ./
search_api.drush.inc - Set the server for a given index.
File
- ./
search_api.drush.inc, line 621 - Drush commands for SearchAPI.
Code
function search_api_drush_get_server($server_id = NULL) {
$ids = isset($server_id) ? array(
$server_id,
) : FALSE;
$servers = search_api_server_load_multiple($ids);
if (empty($servers)) {
drush_set_error(dt('Invalid server_id or no servers present.'));
drush_print();
drush_search_api_server_list();
}
return $servers;
}