You are here

function update_fetch_data_finished in Drupal 8

Same name and namespace in other branches
  1. 7 modules/update/update.fetch.inc \update_fetch_data_finished()
  2. 9 core/modules/update/update.module \update_fetch_data_finished()
  3. 10 core/modules/update/update.module \update_fetch_data_finished()

Batch callback: Performs actions when all fetch tasks have been completed.

Parameters

$success: TRUE if the batch operation was successful; FALSE if there were errors.

$results: An associative array of results from the batch operation, including the key 'updated' which holds the total number of projects we fetched available update data for.

1 string reference to 'update_fetch_data_finished'
UpdateController::updateStatusManually in core/modules/update/src/Controller/UpdateController.php
Manually checks the update status without the use of cron.

File

core/modules/update/update.module, line 498
Handles updates of Drupal core and contributed projects.

Code

function update_fetch_data_finished($success, $results) {
  if ($success) {
    if (!empty($results)) {
      if (!empty($results['updated'])) {
        \Drupal::messenger()
          ->addStatus(\Drupal::translation()
          ->formatPlural($results['updated'], 'Checked available update data for one project.', 'Checked available update data for @count projects.'));
      }
      if (!empty($results['failures'])) {
        \Drupal::messenger()
          ->addError(\Drupal::translation()
          ->formatPlural($results['failures'], 'Failed to get available update data for one project.', 'Failed to get available update data for @count projects.'));
      }
    }
  }
  else {
    \Drupal::messenger()
      ->addError(t('An error occurred trying to get available update data.'), 'error');
  }
}