function drush_pm_releases

8.0.x pm.drush.inc drush_pm_releases()
6.x pm.drush.inc drush_pm_releases()
7.x pm.drush.inc drush_pm_releases()
3.x pm.drush.inc drush_pm_releases()
4.x pm.drush.inc drush_pm_releases()
5.x pm.drush.inc drush_pm_releases()
master pm.drush.inc drush_pm_releases()

Command callback. Show available releases for given project(s).

File

commands/pm/pm.drush.inc, line 1243
The drush Project Manager

Code

function drush_pm_releases() {
  $release_info = drush_get_engine('release_info');

  // Obtain requests.
  $requests = pm_parse_arguments(func_get_args(), FALSE);
  if (!$requests) {
    $requests = array('drupal');
  }

  // Get installed projects.
  if (drush_get_context('DRUSH_BOOTSTRAP_PHASE') >= DRUSH_BOOTSTRAP_DRUPAL_FULL) {
    $projects = drush_get_projects();
  }
  else {
    $projects = array();
  }

  // Select the filter to apply based on cli options.
  if (drush_get_option('dev', FALSE)) {
    $filter = 'dev';
  }
  elseif (drush_get_option('all', FALSE)) {
    $filter = 'all';
  }
  else {
    $filter = '';
  }

  $status_url = drush_get_option('source');

  $output = array();
  foreach ($requests as $request) {
    $request = pm_parse_request($request, $status_url, $projects);
    $project_name = $request['name'];
    $project_release_info = $release_info->get($request);
    if ($project_release_info) {
      $version = isset($projects[$project_name]) ? $projects[$project_name]['version'] : NULL;
      $releases = $project_release_info->filterReleases($filter, $version);
      foreach ($releases as $key => $release) {
        $output["${project_name}-${key}"] = array(
          'project' => $project_name,
          'version' => $release['version'],
          'date' => gmdate('Y-M-d', $release['date']),
          'status' => implode(', ', $release['release_status']),
        ) + $release;
      }
    }
  }
  if (empty($output)) {
    return drush_log(dt('No valid projects given.'), LogLevel::OK);
  }

  return $output;
}