function UpdateController::updateFetchDataFinished

Same name and namespace in other branches
  1. 11.x core/modules/update/src/Controller/UpdateController.php \Drupal\update\Controller\UpdateController::updateFetchDataFinished()

Finished batch callback.

Parameters

bool $success: TRUE if batch successfully completed.

array $results: Batch results.

File

core/modules/update/src/Controller/UpdateController.php, line 97

Class

UpdateController
Controller routines for update routes.

Namespace

Drupal\update\Controller

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.