You are here

private function Update::captureUpdateMessages in DRD Agent 4.0.x

Same name and namespace in other branches
  1. 8.3 src/Agent/Action/Update.php \Drupal\drd_agent\Agent\Action\Update::captureUpdateMessages()

Callback to finally capture all messages from all operations.

Parameters

array $results: The context of the oprations.

1 call to Update::captureUpdateMessages()
Update::batch in src/Agent/Action/Update.php
Callback to determine and execute all required operations.

File

src/Agent/Action/Update.php, line 135

Class

Update
Provides a 'Update' code.

Namespace

Drupal\drd_agent\Agent\Action

Code

private function captureUpdateMessages(array $results) {
  foreach ($results as $module => $updates) {
    if ($module !== '#abort') {
      foreach ($updates as $number => $queries) {
        foreach ($queries as $query) {

          // If there is no message for this update, don't show anything.
          if (empty($query['query'])) {
            continue;
          }
          if ($query['success']) {
            $this->messenger
              ->addMessage($query['query']);
          }
          else {
            $this->messenger
              ->addMessage($query['query'], 'error');
          }
        }
      }
    }
  }
}