function drush_enforce_requirement_drupal_dependencies

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

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

Parameters

$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()

File

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

Code

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.
    if (drush_get_context('DRUSH_BOOTSTRAP_PHASE') < DRUSH_BOOTSTRAP_DRUPAL_FULL) {
      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;
}