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 a class named in the form drush_$type_$engine exists, it will return an instance of the class.

Parameters

string $type: The type of engine.

string $engine: The name for the engine to include.

array $config: Parameters for the engine class constructor.

Return value

TRUE or instanced object of available class on success. FALSE on fail.

54 calls to drush_include_engine()
DrupalBoot::bootstrap_drupal_full in lib/Drush/Boot/DrupalBoot.php
Attempt to load the full Drupal system.
DrupalBoot::drush_enforce_requirement_drupal_dependencies in lib/Drush/Boot/DrupalBoot.php
Check that a command has its declared dependencies available or have no dependencies.
drush_archive_dump in commands/core/archive.drush.inc
Command callback. Generate site archive file.
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.

... See full list

File

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

Code

function drush_include_engine($type, $engine, $config = NULL) {
  $engine_info = drush_get_engines($type);

  // Pick the engine name that actually implements the requested engine.
  $engine = isset($engine_info['engines'][$engine]['implemented-by']) ? $engine_info['engines'][$engine]['implemented-by'] : $engine;

  // Legacy engines live in a subdirectory of the commandfile
  // that declares them. We need to explicitly include the file.
  if (isset($engine_info['engines'][$engine]['path'])) {
    $path = $engine_info['engines'][$engine]['path'];
    if (!drush_include($path, $engine)) {
      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)));
    }
    // Legacy engines may be implemented in a magic class name.
    $class = 'drush_' . $type . '_' . str_replace('-', '_', $engine);
    if (class_exists($class)) {
      $instance = new $class($config);
      $instance->engine_type = $type;
      $instance->engine = $engine;
      return $instance;
    }

    return TRUE;
  }

  return drush_get_class($engine_info['engines'][$engine]['class'], array($type, $engine, $config));
}