You are here

function _apachesolr_drush_environment_load_and_validate in Apache Solr Search 8

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

Load an environment from an id and validate the result.

Parameters

string $env_id:

Return value

array $environment

Throws

Exception

4 calls to _apachesolr_drush_environment_load_and_validate()
apachesolr_drush_solr_get_env_name in drush/apachesolr.drush.inc
Get the environment name based on the environment ID
apachesolr_drush_solr_get_env_url in drush/apachesolr.drush.inc
Get the environment url based on the environment ID
apachesolr_drush_solr_set_env_url in drush/apachesolr.drush.inc
Set the environment url based on the environment ID
_apachesolr_drush_variable_like in drush/apachesolr.drush.inc
Search for similar variable names.

File

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

Code

function _apachesolr_drush_environment_load_and_validate($env_id) {
  $environment = apachesolr_environment_load($env_id);
  if (!$environment) {
    throw new Exception(dt('!env_id is not a valid environment ID.', array(
      '!env_id' => $env_id,
    )));
  }
  drush_log(dt('Using environment ID: "!env_id"', array(
    '!env_id' => $env_id,
  )), 'success');
  return $environment;
}