MDL-52319 upgrade: Better report the environment checks in CLI scripts

Before we did not display the source of the environment check failure
(whether it was a core check or a plugin) and there was a missing space
before the "Error" status.
This commit is contained in:
David Mudrák
2020-03-23 11:23:43 +01:00
parent fb37a2d49d
commit 754f641f85
+8 -1
View File
@@ -140,6 +140,7 @@ function environment_get_errors($environment_results) {
$type = $environment_result->getPart();
$info = $environment_result->getInfo();
$status = $environment_result->getStatus();
$plugin = $environment_result->getPluginName();
$error_code = $environment_result->getErrorCode();
$a = new stdClass();
@@ -209,7 +210,13 @@ function environment_get_errors($environment_results) {
// Append the restrict if there is some
$feedbacktext .= $environment_result->strToReport($environment_result->getRestrictStr(), 'error');
$report .= html_to_text($feedbacktext);
if ($plugin === '') {
$report = '[' . get_string('coresystem') . '] ' . $report;
} else {
$report = '[' . $plugin . '] ' . $report;
}
$report .= ' - ' . html_to_text($feedbacktext);
if ($environment_result->getPart() == 'custom_check'){
$errors[] = array($info, $report);