function DatabaseUpdate::getRequirements

Same name and namespace in other branches
  1. main core/lib/Drupal/Core/Update/DatabaseUpdate.php \Drupal\Core\Update\DatabaseUpdate::getRequirements()

Checks update requirements and reports errors and (optionally) warnings.

Return value

array<string, array{'title': \Drupal\Core\StringTranslation\TranslatableMarkup, 'value': mixed, description: \Drupal\Core\StringTranslation\TranslatableMarkup, 'severity': \Drupal\Core\Extension\Requirement\RequirementSeverity}> An array of requirements, in the same format as is returned by hook_requirements().

See also

hook_requirements()

File

core/lib/Drupal/Core/Update/DatabaseUpdate.php, line 74

Class

DatabaseUpdate
Drupal database update API.

Namespace

Drupal\Core\Update

Code

public function getRequirements() : array {
  // Because this is one of the earliest points in the update process,
  // detect and fix missing schema versions for modules here to ensure
  // it runs on all update code paths.
  $this->fixMissingSchema();
  // Check requirements of all loaded modules.
  $requirements = array_merge($this->moduleHandler
    ->invokeAll('requirements', [
    'update',
  ]), $this->moduleHandler
    ->invokeAll('update_requirements'));
  $this->moduleHandler
    ->alter('requirements', $requirements);
  $this->moduleHandler
    ->alter('update_requirements', $requirements);
  $requirements += $this->systemSchemaRequirements();
  return $requirements;
}

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