You are here

function apachesolr_drush_solr_get_env_name in Apache Solr Search 8

Same name and namespace in other branches
  1. 6.3 drush/apachesolr.drush.inc \apachesolr_drush_solr_get_env_name()
  2. 7 drush/apachesolr.drush.inc \apachesolr_drush_solr_get_env_name()

Get the environment name based on the environment ID

@print The environment name

Return value

mixed APACHESOLR_ENV_ID_ERROR Only return error if the environment can't be found

1 string reference to 'apachesolr_drush_solr_get_env_name'
apachesolr_drush_command in drush/apachesolr.drush.inc
Implements hook_drush_command().

File

drush/apachesolr.drush.inc, line 354
drush integration for apachesolr.

Code

function apachesolr_drush_solr_get_env_name() {
  $env_id = drush_get_option('id', apachesolr_default_environment());
  try {
    $environment = _apachesolr_drush_environment_load_and_validate($env_id);
  } catch (Exception $e) {
    return drush_set_error('APACHESOLR_ENV_ID_ERROR', $e
      ->getMessage());
  }
  drush_print($environment['name']);
}