function drush_enforce_requirement_drupal_dependencies

6.x drush_enforce_requirement_drupal_dependencies(&$command)
3.x drush_enforce_requirement_drupal_dependencies(&$command)
4.x drush_enforce_requirement_drupal_dependencies(&$command)
5.x drush_enforce_requirement_drupal_dependencies(&$command)

Check that a command has its declared dependencies available or have no dependencies.


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

Return value

TRUE if command is valid.

1 call to drush_enforce_requirement_drupal_dependencies()


includes/, line 1659
The drush command engine.


function drush_enforce_requirement_drupal_dependencies(&$command) {
  // If the command bootstrap is DRUSH_BOOTSTRAP_MAX, then we will
  // allow the requirements to pass if we have not successfully
  // bootstrapped Drupal.  The combination of DRUSH_BOOTSTRAP_MAX
  // and 'drupal dependencies' indicates that the drush command
  // will use the dependent modules only if they are available.
  if ($command['bootstrap'] == DRUSH_BOOTSTRAP_MAX) {
    // If we have not bootstrapped, then let the dependencies pass;
    // if we have bootstrapped, then enforce them.
      return TRUE;
  // If there are no drupal dependencies, then do nothing
  if (!empty($command['drupal dependencies'])) {
    foreach ($command['drupal dependencies'] as $dependency) {
      if (!function_exists('module_exists') || !module_exists($dependency)) {
        $command['bootstrap_errors']['DRUSH_COMMAND_DEPENDENCY_ERROR'] = dt('Command !command needs the following modules installed/enabled to run: !dependencies.', array('!command' => $command['command'], '!dependencies' => implode(', ', $command['drupal dependencies'])));
        return FALSE;
  return TRUE;