You are here

function drush_search_api_server_enable in Search API 7

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

Enables a search server.

Parameters

int|string $server_id: The numeric ID or machine name of the server to enable.

File

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

Code

function drush_search_api_server_enable($server_id = NULL) {
  if (!isset($server_id)) {
    drush_print(dt('Please provide a valid server id.'));
    return;
  }
  $server = search_api_server_load($server_id);
  if (empty($server)) {
    drush_print(dt('The server was not able to load.'));
    return;
  }
  else {
    $server
      ->update(array(
      'enabled' => 1,
    ));
    drush_print(dt('The server was enabled successfully.'));
  }
}