function make_download_pm

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

Download project using drush's pm-download command.

File

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

Code

function make_download_pm($name, $type, $download, $download_location) {
  $full_project_version = $name . '-' . $download['full_version'];

  $options = array(
    'destination' => dirname($download_location),
    'yes' => TRUE,
    'package-handler' => 'wget',
    'source' => $download['status url'],
    
    // This is only relevant for profiles, but we always want the variant to
    // be 'profile-only' so we don't end up with extra copies of core.
    'variant' => $type == 'core' ? 'full' : 'profile-only',
    'cache' => TRUE,
  );
  if ($type == 'core') {
    $options['drupal-project-rename'] = basename($download_location);
  }
  if (drush_get_option('no-cache', FALSE)) {
    unset($options['cache']);
  }

  $backend_options = array();
  if (!drush_get_option(array('verbose', 'debug'), FALSE)) {
    $backend_options['integrate'] = TRUE;
    $backend_options['log'] = FALSE;
  }

  // Perform actual download with `drush pm-download`.
  $return = drush_invoke_process('@none', 'pm-download', array($full_project_version), $options, $backend_options);
  if (empty($return['error_log'])) {
    // @todo Report the URL we used for download. See
    // http://drupal.org/node/1452672.
    drush_log(dt('@project downloaded.', array('@project' => $full_project_version)), LogLevel::OK);
  }
}