function make_download_svn

8.0.x make.download.inc make_download_svn($name, $type, $download, $download_location)
6.x make.download.inc make_download_svn($name, $type, $download, $download_location)
7.x make.download.inc make_download_svn($name, $type, $download, $download_location)
5.x make.download.inc make_download_svn($name, $type, $download, $download_location)
master make.download.inc make_download_svn($name, $type, $download, $download_location)

Checks out an SVN repository to the specified download location.

Return value

mixed The download location on success, FALSE otherwise.

File

commands/make/make.download.inc, line 395
Download-specific functions for Drush Make.

Code

function make_download_svn($name, $type, $download, $download_location) {
  if (!empty($download['url'])) {
    if (!empty($download['interactive'])) {
      $function = 'drush_shell_exec_interactive';
    }
    else {
      $options = ' --non-interactive';
      $function = 'drush_shell_exec';
    }
    if (!isset($download['force']) || $download['force']) {
      $options = ' --force';
    }
    if (drush_get_option('working-copy')) {
      $command = 'svn' . $options . ' checkout';
    }
    else {
      $command = 'svn' . $options . ' export';
    }

    $args = array();

    if (isset($download['revision'])) {
      $command .= ' -r%s';
      $args[] = $download['revision'];
    }

    $command .= ' %s %s';
    $args[] = $download['url'];
    $args[] = $download_location;

    if (!empty($download['username'])) {
      $command .= ' --username %s';
      $args[] = $download['username'];
      if (!empty($download['password'])) {
        $command .= ' --password %s';
        $args[] = $download['password'];
      }
    }
    array_unshift($args, $command);
    $result = call_user_func_array($function, $args);
    if ($result) {
      $args = array(
        '@project' => $name,
        '@command' => $command,
        '@url' => $download['url'],
      );
      drush_log(dt('@project @command from @url.', $args), 'ok');
      return $download_location;
    }
    else {
      $download['url'] = dt("unspecified location");
    }
  }
  else {
    make_error('DOWNLOAD_ERROR', dt('Unable to download @project from @url.', array('@project' => $name, '@url' => $download['url'])));
    return FALSE;
  }
}