You are here

function drush_search_api_server_list in Search API 7

Same name and namespace in other branches
  1. 8 search_api.drush.inc \drush_search_api_server_list()

Lists all search servers.

1 call to drush_search_api_server_list()
search_api_drush_get_server in ./search_api.drush.inc
Returns a server or all servers as an array.

File

./search_api.drush.inc, line 656
Drush commands for SearchAPI.

Code

function drush_search_api_server_list() {
  if (search_api_drush_static(__FUNCTION__)) {
    return;
  }
  $servers = search_api_server_load_multiple(FALSE);
  if (empty($servers)) {
    drush_print(dt('There are no servers present.'));
    return;
  }
  $rows[] = array(
    dt('Machine name'),
    dt('Name'),
    dt('Status'),
  );
  foreach ($servers as $server) {
    $row = array(
      $server->machine_name,
      $server->name,
      $server->enabled ? dt('enabled') : dt('disabled'),
    );
    $rows[] = $row;
  }
  drush_print_table($rows);
}