function drush_load_command_engine

8.0.x engines.inc drush_load_command_engine($command, $engine_type, $metadata = array())
6.x engines.inc drush_load_command_engine($command, $engine_type, $metadata = array())
7.x engines.inc drush_load_command_engine($command, $engine_type, $metadata = array())
master engines.inc drush_load_command_engine($command, $engine_type, $metadata = array())

Selects and loads an engine implementing the given type.

Loaded engines are stored as a context.

2 calls to drush_load_command_engine()
drush_load_command_engines in includes/engines.inc
Include, instantiate and validate command engines.
drush_set_default_outputformat in commands/core/outputformat.drush.inc
Dynamically switch to a new output format. Does NOT override user-selected output format.

File

includes/engines.inc, line 166
The drush engines API implementation and helpers.

Code

function drush_load_command_engine($command, $engine_type, $metadata = array()) {
  drush_log(dt("Loading !engine engine.", array('!engine' => $engine_type), LogLevel::BOOTSTRAP));

  $config = drush_get_command_engine_config($command, $engine_type, $metadata);
  $engine_info = drush_get_engines($engine_type);
  $engine = drush_select_engine($config, $engine_info);
  $version = drush_drupal_major_version();

  $context = $engine_type . '_engine_' . $engine . '_' . $version;
  $instance = drush_get_context($context, FALSE);
  if ($instance != FALSE) {
    drush_set_engine($engine_type, $instance);
  }
  else {
    $instance = drush_load_engine($engine_type, $engine, $config);
    if ($instance == FALSE) {
      return FALSE;
    }
    drush_set_context($context, $instance);
  }
  return $instance;
}