function _pm_get_update_info

6.x drupal.inc _pm_get_update_info($projects)
6.x drupal_6.inc _pm_get_update_info($projects)
3.x drupal_6.inc _pm_get_update_info($projects = NULL)
3.x drupal_7.inc _pm_get_update_info($projects = NULL)
3.x drupal_5.inc _pm_get_update_info($projects = NULL)
4.x drupal.inc _pm_get_update_info($projects)
4.x drupal_6.inc _pm_get_update_info($projects)
4.x drupal_5.inc _pm_get_update_info($projects)
5.x drupal.inc _pm_get_update_info($projects)
5.x drupal_6.inc _pm_get_update_info($projects)

Get update information for all installed projects.

Return value

An array containing remote and local versions for all installed projects

See also

update_get_available().

update_manual_status().

1 call to _pm_get_update_info()
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/update_info/drupal.inc, line 58

Code

function _pm_get_update_info($projects) {
  // Force to invalidate some caches that are only cleared
  // when visiting update status report page. This allow to detect changes in
  // .info files.
  _update_cache_clear('update_project_data');
  _update_cache_clear('update_project_projects');

  // From update_get_available(): Iterate all projects and create a fetch task
  // for those we have no information or is obsolete.
  module_load_include('inc', 'update', 'update.compare');
  $available = _update_get_cached_available_releases();
  $update_projects = update_get_projects();
  foreach ($update_projects as $key => $project) {
    if (empty($available[$key])) {
      update_create_fetch_task($project);
      continue;
    }
    if ($project['info']['_info_file_ctime'] > $available[$key]['last_fetch']) {
      $available[$key]['fetch_status'] = UPDATE_FETCH_PENDING;
    }
    if (empty($available[$key]['releases'])) {
      $available[$key]['fetch_status'] = UPDATE_FETCH_PENDING;
    }
    if (!empty($available[$key]['fetch_status']) && $available[$key]['fetch_status'] == UPDATE_FETCH_PENDING) {
      update_create_fetch_task($project);
    }
  }

  // Set a batch to process all pending tasks.
  $batch = array(
    'operations' => array(
      array('update_fetch_data_batch', array()),
    ),
    'finished' => 'update_fetch_data_finished',
    'file' => drupal_get_path('module', 'update') . '/update.fetch.inc',
  );
  batch_set($batch);
  drush_backend_batch_process();

  // Clear any error set by a failed update fetch task. This avoid rollbacks.
  drush_clear_error();

  // Calculate update status data.
  $available = _update_get_cached_available_releases();
  $data = update_calculate_project_data($available);
  foreach ($data as $project_name => $project) {
    // Discard custom projects.
    if ($project['status'] == UPDATE_UNKNOWN) {
      unset($data[$project_name]);
      continue;
    }
    // Allow to update disabled projects.
    if (in_array($project['project_type'], array('module-disabled', 'theme-disabled'))) {
      $data[$project_name]['project_type'] = substr($project['project_type'], 0, strpos($project['project_type'], '-'));
    }
    // Set 'includes' key to all extensions. By default it only contain enabled
    // extensions and _pm_get_project_path() needs all of them.
    $data[$project_name]['includes'] = drupal_map_assoc($projects[$project_name]['extensions']);
    // Store all releases, not just the ones selected by update.module.
    $data[$project_name]['releases'] = $available[$project_name]['releases'];
  }
  $data = _pm_get_project_path($data, 'includes');

  return $data;
}