function drush_include_engine

8.0.x engines.inc drush_include_engine($type, $engine, $config = NULL)
6.x engines.inc drush_include_engine($type, $selected_engine, $version = NULL, $path = NULL, $engine_config = NULL)
7.x engines.inc drush_include_engine($type, $engine, $config = NULL)
3.x drush.inc drush_include_engine($type, $engine, $version = NULL, $path = NULL)
4.x drush.inc drush_include_engine($type, $engine, $version = NULL, $path = NULL)
5.x drush.inc drush_include_engine($type, $engine, $version = NULL, $path = NULL)
master engines.inc drush_include_engine($type, $engine, $config = NULL)

Include the engine code for a specific named engine of a certain type.

If the engine type has implemented hook_drush_engine_$type the path to the engine specified in the array will be used.

If you don't need to present any user options for selecting the engine (which is common if the selection is implied by the running environment) and you don't need to allow other modules to define their own engines you can simply pass the $path to the directory where the engines are, and the appropriate one will be included.

Unlike drush_include this function will set errors if the requested engine cannot be found.

Parameters

$type: The type of engine.

$engine: The key for the engine to be included.

$version: The version of the engine to be included - defaults to the current Drupal core major version.

$path: A path to include from, if the engine has no corresponding hook_drush_engine_$type item path.

Return value

unknown_type

18 calls to drush_include_engine()
core_watchdog_format_result in commands/core/watchdog.drush.inc
Format a watchdog database row.
core_watchdog_query in commands/core/watchdog.drush.inc
Build a WHERE snippet based on given parameters.
drush_backend_batch_process in includes/batch.inc
Process a Drupal batch by spawning multiple Drush processes.
drush_batch_command in includes/batch.inc
Process sets from the specified batch.
drush_core_updatedb in commands/core/core.drush.inc
Command handler. Execute update.php code from drush.

... See full list

File

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

Code

function drush_include_engine($type, $engine, $version = NULL, $path = NULL) {
  $engines = drush_get_engines($type);
  if (!$path && isset($engines[$engine])) {
    $path = $engines[$engine]['path'];
  }
  if (!$path) {
    return drush_set_error('DRUSH_ENGINE INCLUDE_NO_PATH', dt('No !path was set for including the !type engine !engine.', array('!path' => $path, '!type' => $type, '!engine' => $engine)));
  }
  if (drush_include($path, $engine, $version)) {
    return TRUE;
  }
  return drush_set_error('DRUSH_ENGINE INCLUDE_FAILED', dt('Unable to include the !type engine !engine from !path.', array('!path' => $path, '!type' => $type, '!engine' => $engine)));
}