From 754f641f855913d42b0ebd55d77556efdcd03f9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mudr=C3=A1k?= Date: Fri, 13 Mar 2020 18:34:16 +0100 Subject: [PATCH] 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. --- lib/environmentlib.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/environmentlib.php b/lib/environmentlib.php index 3daebaebc64..64a3a4ffed9 100644 --- a/lib/environmentlib.php +++ b/lib/environmentlib.php @@ -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);