function drush_enforce_requirement_drush_dependencies

8.0.x command.inc drush_enforce_requirement_drush_dependencies(&$command)
6.x command.inc drush_enforce_requirement_drush_dependencies(&$command)
7.x command.inc drush_enforce_requirement_drush_dependencies(&$command)
4.x command.inc drush_enforce_requirement_drush_dependencies(&$command)
5.x command.inc drush_enforce_requirement_drush_dependencies(&$command)
master command.inc drush_enforce_requirement_drush_dependencies(&$command)

Check that a command has its declared drush dependencies available or have no dependencies. Drush dependencies are helpful when a command is invoking another command, or implementing its API.

Parameters

$command: Command to check. Any errors will be added to the 'bootstrap_errors' element.

Return value

TRUE if dependencies are met.

1 call to drush_enforce_requirement_drush_dependencies()
BaseBoot::enforce_requirement in lib/Drush/Boot/BaseBoot.php
Called by Drush when a command is selected, but before it runs. This gives the Boot class an opportunity to determine if any minimum requirements (e.g. minimum Drupal version) declared in the command have been met.

File

includes/command.inc, line 1790
The drush command engine.

Code

function drush_enforce_requirement_drush_dependencies(&$command) {
  // If there are no drush dependencies, then do nothing.
  if (!empty($command['drush dependencies'])) {
    $commandfiles = drush_commandfile_list();
    foreach ($command['drush dependencies'] as $dependency) {
      if (!isset($commandfiles[$dependency])) {
        $dt_args = array(
          '!command' => $command['command'],
          '!dependency' => "$dependency.drush.inc",
        );
        $command['bootstrap_errors']['DRUSH_COMMANDFILE_DEPENDENCY_ERROR'] = dt('Command !command needs the following drush command file to run: !dependency.', $dt_args);
        return FALSE;
      }
    }
  }
  return TRUE;
}