function pm_project_filter

8.0.x updatestatus.pm.inc pm_project_filter($update_info, $security_only)
6.x updatestatus.pm.inc pm_project_filter($update_info, $security_only)
7.x updatestatus.pm.inc pm_project_filter($update_info, $security_only)
3.x updatecode.pm.inc pm_project_filter(&$projects, &$rows)
4.x updatecode.pm.inc pm_project_filter(&$update_info, &$rows, $security_only)
5.x updatecode.pm.inc pm_project_filter(&$update_info, &$rows, $security_only)
master updatestatus.pm.inc pm_project_filter($update_info, $security_only)

Return an array of updateable projects and fill $rows.

Array of updateable projects is obtained from calculated project update status and $security_only flag.

1 call to pm_project_filter()
drush_pm_updatecode in commands/pm/updatecode.pm.inc
Command callback. Displays update status info and allows to update installed projects. Pass specific projects as arguments, otherwise we update all that have candidate releases.

File

commands/pm/updatecode.pm.inc, line 510

Code

function pm_project_filter(&$update_info, &$rows, $security_only) {
  $updateable = array();
  foreach ($update_info as $key => $project) {
    if (empty($project['title'])) {
      continue;
    }
    switch ($project['status']) {
      case DRUSH_PM_REQUESTED_UPDATE:
        $status = dt('Specified version available');
        $project['updateable'] = TRUE;
        break;
      case DRUSH_PM_REQUESTED_CURRENT:
        $status = dt('Specified version already installed');
        break;
      case DRUSH_PM_REQUESTED_PROJECT_NOT_PACKAGED:
        $status = $project['status_msg'];
        break;
      case DRUSH_PM_REQUESTED_VERSION_NOT_FOUND:
        $status = dt('Specified version not found');
        break;
      case DRUSH_PM_REQUESTED_PROJECT_NOT_FOUND:
        $status = dt('Specified project not found');
        break;
      case DRUSH_PM_REQUESTED_PROJECT_NOT_UPDATEABLE:
        $status = dt('Project has no enabled extensions and can\'t be updated');
        break;
      default:
        $status = pm_update_filter($project);
        break;
    }

    // Special checking:  if drush decides that the candidate version is older
    // than the installed version, then we will set the candidate version to
    // the installed version.
    if (isset($project['candidate_version'], $project['releases'][$project['candidate_version']], $project['releases'][$project['existing_version']])) {
      if ($project['releases'][$project['candidate_version']]['date'] < $project['releases'][$project['existing_version']]['date']) {
        $project['candidate_version'] = $project['existing_version'];
      }
    }

    if (isset($project['locked'])) {
      $status = $project['locked'] . " ($status)";
    }

    // Persist candidate_version in $update_info (plural).
    if (empty($project['candidate_version'])) {
      $update_info[$key]['candidate_version'] = $project['existing_version']; // Default to no change
    }
    else {
      $update_info[$key]['candidate_version'] = $project['candidate_version'];
    }
    if (!empty($project['updateable'])) {
      $updateable[$key] = $project;
      // Find only security updates
      if ($security_only && ($project['status'] != UPDATE_NOT_SECURE)) {
        unset($updateable[$key]);
      }
    }
    $rows[] = array($project['title'], $project['existing_version'], $update_info[$key]['candidate_version'], $status);
  }
  return $updateable;
}