function UpdateController::updateStatus

Same name and namespace in other branches
  1. 9 core/modules/update/src/Controller/UpdateController.php \Drupal\update\Controller\UpdateController::updateStatus()
  2. 8.9.x core/modules/update/src/Controller/UpdateController.php \Drupal\update\Controller\UpdateController::updateStatus()
  3. 10 core/modules/update/src/Controller/UpdateController.php \Drupal\update\Controller\UpdateController::updateStatus()

Returns a page about the update status of projects.

Return value

array A build array with the update status of projects.

1 string reference to 'UpdateController::updateStatus'
update.routing.yml in core/modules/update/update.routing.yml
core/modules/update/update.routing.yml

File

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

Class

UpdateController
Controller routines for update routes.

Namespace

Drupal\update\Controller

Code

public function updateStatus() {
    $build = [
        '#theme' => 'update_report',
    ];
    if ($available = update_get_available(TRUE)) {
        $this->moduleHandler()
            ->loadInclude('update', 'compare.inc');
        $build['#data'] = update_calculate_project_data($available);
        // @todo Consider using 'fetch_failures' from the 'update' collection
        // in the key_value_expire service for this?
        $fetch_failed = FALSE;
        foreach ($build['#data'] as $project) {
            if ($project['status'] === UpdateFetcherInterface::NOT_FETCHED) {
                $fetch_failed = TRUE;
                break;
            }
        }
        if ($fetch_failed) {
            $message = [
                '#theme' => 'update_fetch_error_message',
            ];
            $this->messenger()
                ->addError($this->renderer
                ->renderInIsolation($message));
        }
    }
    return $build;
}

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