function drush_enforce_requirement_core

8.0.x drush_enforce_requirement_core(&$command)
6.x drush_enforce_requirement_core(&$command)
7.x drush_enforce_requirement_core(&$command)
3.x drush_enforce_requirement_core(&$command)
4.x drush_enforce_requirement_core(&$command)
5.x drush_enforce_requirement_core(&$command)
master drush_enforce_requirement_core(&$command)

Check that a command is valid for the current major version of core. Handles explicit version numbers and 'plus' numbers like 7+ (compatible with 7,8 ...).


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


includes/, line 1906
The drush command engine.


function drush_enforce_requirement_core(&$command) {
  $major = drush_drupal_major_version();
  if (!$core = $command['core']) {
    return TRUE;
  foreach ($core as $compat) {
    if ($compat == $major) {
      return TRUE;
    elseif (substr($compat, -1) == '+' && $major >= substr($compat, 0, strlen($compat) -1)) {
      return TRUE;
  $versions = array_pop($core);
  if (!empty($core)) {
    $versions = implode(', ', $core) . dt(' or ') . $versions;
  $command['bootstrap_errors']['DRUSH_COMMAND_CORE_VERSION_ERROR'] = dt('Command !command requires Drupal core version !versions to run.', array('!command' => $command['command'], '!versions' => $versions));