1 install.core.inc | install_display_requirements($install_state, $requirements) |
Verifies the requirements for installing Backdrop.
Parameters
array $install_state: An array of information about the current installation state.
Return value
string|NULL: 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
Exception
File
- core/
includes/ install.core.inc, line 1798 - API functions for installing Backdrop.
Code
function install_display_requirements($install_state, $requirements) {
// Check the severity of the requirements reported.
$severity = backdrop_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 backdrop_requirements_url().
if ($severity == REQUIREMENT_ERROR || ($severity == REQUIREMENT_WARNING && empty($install_state['parameters']['continue']))) {
if ($install_state['interactive']) {
backdrop_set_title(st('Requirements problem'));
$status_report = st('Resolve the problems and <a href="!url">try again</a>.', array('!url' => check_url(backdrop_requirements_url($severity))));
$status_report .= '<br><br>';
$status_report .= theme(
'status_report', array(
'requirements' => $requirements,
'phase' => 'install',
)
);
return $status_report;
}
else {
// Throw an exception showing any unmet requirements.
$failures = array();
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 Exception(implode("\n\n", $failures));
}
}
}
// Non-interactive requirements check.
return NULL;
}