function package_handler_validate

8.0.x wget.inc package_handler_validate()
8.0.x git_drupalorg.inc package_handler_validate()
6.x wget.inc package_handler_validate()
6.x git_drupalorg.inc package_handler_validate()
7.x wget.inc package_handler_validate()
7.x git_drupalorg.inc package_handler_validate()
4.x wget.inc package_handler_validate()
4.x git_drupalorg.inc package_handler_validate()
4.x cvs.inc package_handler_validate()
5.x wget.inc package_handler_validate()
5.x git_drupalorg.inc package_handler_validate()
master wget.inc package_handler_validate()
master git_drupalorg.inc package_handler_validate()

Validate this package handler can run.

File

commands/pm/package_handler/git_drupalorg.inc, line 13
Drush PM drupal.org Git extension.

Code

function package_handler_validate() {
  // Check git command exists. Disable possible output.
  $debug = drush_get_context('DRUSH_DEBUG');
  drush_set_context('DRUSH_DEBUG', FALSE);

  // We need to check for a git executable and then make sure version is >=1.7
  // (avoid drush_shell_exec because we want to run this even in --simulated mode.)
  $success = exec('git --version', $git);
  $git_version_array = explode(" ", $git[0]);
  $git_version = $git_version_array[2];

  drush_set_context('DRUSH_DEBUG', $debug);
  if (!$success) {
    return drush_set_error('DRUSH_SHELL_COMMAND_NOT_FOUND', dt('git executable not found.'));
  }
  elseif ($git_version < '1.7') {
    return drush_set_error('GIT_VERSION_UNSUPPORTED', dt('Your git version !git_version is not supported; please upgrade to git 1.7 or later.', array('!git_version' => $git_version)));
  }
  // Check git_deploy is enabled. Only for bootstrapped sites.
  if (drush_get_context('DRUSH_BOOTSTRAP_PHASE') >= DRUSH_BOOTSTRAP_DRUPAL_FULL) {
    drush_include_engine('drupal', 'environment');
    if (!drush_get_option('gitinfofile') && !drush_module_exists('git_deploy')) {
      drush_log(dt('git package handler needs git_deploy module enabled to work properly.'), LogLevel::WARNING);
    }
  }

  return TRUE;
}