function install_display_requirements
Same name in other branches
- 9 core/includes/install.core.inc \install_display_requirements()
- 10 core/includes/install.core.inc \install_display_requirements()
- 11.x core/includes/install.core.inc \install_display_requirements()
Displays installation requirements.
Parameters
array $install_state: An array of information about the current installation state.
array $requirements: An array of requirements, in the same format as is returned by hook_requirements().
Return value
A themed status report, or an exception if there are requirement errors. If there are only requirement warnings, a themed status report is shown initially, but the user is allowed to bypass it by providing 'continue=1' in the URL. Otherwise, no output is returned, so that the next task can be run in the same page request.
Throws
\Drupal\Core\Installer\Exception\InstallerException
2 calls to install_display_requirements()
- install_download_translation in core/
includes/ install.core.inc - Download a translation file for the selected language.
- install_verify_requirements in core/
includes/ install.core.inc - Verifies the requirements for installing Drupal.
File
-
core/
includes/ install.core.inc, line 2267
Code
function install_display_requirements($install_state, $requirements) {
// Check the severity of the requirements reported.
$severity = drupal_requirements_severity($requirements);
// If there are errors, always display them. If there are only warnings, skip
// them if the user has provided a URL parameter acknowledging the warnings
// and indicating a desire to continue anyway. See drupal_requirements_url().
if ($severity == REQUIREMENT_ERROR || $severity == REQUIREMENT_WARNING && empty($install_state['parameters']['continue'])) {
if ($install_state['interactive']) {
$build['report']['#type'] = 'status_report';
$build['report']['#requirements'] = $requirements;
if ($severity == REQUIREMENT_WARNING) {
$build['#title'] = t('Requirements review');
$build['#suffix'] = t('Check the messages and <a href=":retry">retry</a>, or you may choose to <a href=":cont">continue anyway</a>.', [
':retry' => drupal_requirements_url(REQUIREMENT_ERROR),
':cont' => drupal_requirements_url($severity),
]);
}
else {
$build['#title'] = t('Requirements problem');
$build['#suffix'] = t('Check the messages and <a href=":url">try again</a>.', [
':url' => drupal_requirements_url($severity),
]);
}
return $build;
}
else {
// Throw an exception showing any unmet requirements.
$failures = [];
foreach ($requirements as $requirement) {
// Skip warnings altogether for non-interactive installations; these
// proceed in a single request so there is no good opportunity (and no
// good method) to warn the user anyway.
if (isset($requirement['severity']) && $requirement['severity'] == REQUIREMENT_ERROR) {
$failures[] = $requirement['title'] . ': ' . $requirement['value'] . "\n\n" . $requirement['description'];
}
}
if (!empty($failures)) {
throw new InstallerException(implode("\n\n", $failures));
}
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.