function pm_update_packages

8.0.x pm_update_packages($update_info, $tmpfile)
6.x pm_update_packages($update_info, $tmpfile)
7.x pm_update_packages($update_info, $tmpfile)
3.x pm_update_packages($projects)
4.x pm_update_packages($update_info, $tmpfile)
5.x pm_update_packages($update_info, $tmpfile)
master pm_update_packages($update_info, $tmpfile)

Update packages according to an array of releases, following interactive confirmation from the user.


$projects: An array of projects from the update service, with an additional array key candidate_version that specifies the version to be installed.

1 call to pm_update_packages()
drush_pm_updatecode in commands/pm/
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.


commands/pm/, line 230


function pm_update_packages($projects) {
  drush_include_engine('package_handler', drush_get_option('package-handler', 'wget'));
  $drupal_root = drush_get_context('DRUSH_DRUPAL_ROOT');

  drush_print(dt('Code updates will be made to the following projects:'));
  foreach ($projects as $project) {
    $print .= $project['title'] . " [" . $project['name'] . '-' . $project['candidate_version'] . "], ";
  drush_print(substr($print, 0, strlen($print) -2));
  drush_print(dt("Note: Updated projects can potentially break your site. It is NOT recommended to update production sites without prior testing."));
  drush_print(dt("Note: A backup of your package will be stored to backups directory if it is not managed by a supported version control system."));
  drush_print(dt('Note: If you have made any modifications to any file that belongs to one of these projects, you will have to migrate those modifications after updating.'));
  if (!drush_confirm(dt('Do you really want to continue?'))) {

  // Now we start the actual updating.
  foreach ($projects as $project) {
    if (empty($project['path'])) {
      return drush_set_error('DRUSH_PM_UPDATING_NO_PROJECT_PATH', dt('The !project project path is not available, perhaps the !type is enabled but has been deleted from disk.', array('!project' => $project['name'], '!type' => $project['project_type'])));
    drush_log(dt('Starting to update !project code at !dir...', array('!project' => $project['title'], '!dir' => $project['path'])));
    // Create the projects directory and base (parent) directory.
    $project['full_project_path'] = $drupal_root . '/' . $project['path'];
    // Check that the directory exists, and is where we expect it to be.
    if (stripos($project['path'], $project['project_type']) === FALSE || !is_dir($project['full_project_path'])) {
      return drush_set_error('DRUSH_PM_UPDATING_PATH_NOT_FOUND', dt('The !project directory could not be found within the !types directory at !full_project_path, perhaps the project is enabled but has been deleted from disk.', array('!project' => $project['name'], '!type' => $project['project_type'], '!full_project_path' => $project['full_project_path'])));
    if (!$version_control = drush_pm_include_version_control($project['full_project_path'])) {
      return FALSE;
    $project['base_project_path'] = dirname($project['full_project_path']);
    // Check we have a version control system, and it clears its pre-flight.
    if (!$version_control->pre_update($project)) {
      return FALSE;
    // Run update on one project
    if (pm_update_project($project, $version_control) === FALSE) {
      return FALSE;
    pm_update_complete($project, $version_control);
  // Clear the cache, since some projects could have moved around.