protected function StatusInfoDrupal8::calculateUpdateStatus

8.0.x StatusInfoDrupal8.php protected StatusInfoDrupal8::calculateUpdateStatus($available, $projects)
7.x StatusInfoDrupal8.php protected StatusInfoDrupal8::calculateUpdateStatus($available, $projects)
master StatusInfoDrupal8.php protected StatusInfoDrupal8::calculateUpdateStatus($available, $projects)

Calculates update status for all projects via update.module.

1 call to StatusInfoDrupal8::calculateUpdateStatus()
StatusInfoDrupal8::getStatus in lib/Drush/UpdateService/StatusInfoDrupal8.php
Get update information for all installed projects.

File

lib/Drush/UpdateService/StatusInfoDrupal8.php, line 141
Implementation of 'drupal' update_status engine for Drupal 8.

Namespace

Drush\UpdateService

Class

StatusInfoDrupal8

Code

protected function calculateUpdateStatus($available, $projects) {
  module_load_include('inc', 'update', 'update.compare');
  $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;
    }
    // Discard projects with unknown installation path.
    if ($project_name != 'drupal' && !isset($projects[$project_name]['path'])) {
      unset($data[$project_name]);
      continue;
    }

    // Add some info from the project to $data.
    $data[$project_name] += array(
      'path' => isset($projects[$project_name]['path']) ? $projects[$project_name]['path'] : '',
      'label' => $projects[$project_name]['label'],
    );
    // Store all releases, not just the ones selected by update.module.
    // We use it to allow the user to update to a specific version.
    if (isset($available[$project_name]['releases'])) {
      $data[$project_name]['releases'] = $available[$project_name]['releases'];
    }
  }

  return $data;
}