mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-79809 environment: Add recommended custom check
Add support for custom environment checks to have a recommended option in addition to required an optional.
This commit is contained in:
parent
17124e62a9
commit
2978ffc4a5
@ -2052,8 +2052,10 @@ class core_admin_renderer extends plugin_renderer_base {
|
|||||||
// We are checking installed & enabled things
|
// We are checking installed & enabled things
|
||||||
if ($environment_result->getLevel() == 'required') {
|
if ($environment_result->getLevel() == 'required') {
|
||||||
$stringtouse = 'environmentrequirecustomcheck';
|
$stringtouse = 'environmentrequirecustomcheck';
|
||||||
} else {
|
} else if ($environment_result->getLevel() == 'optional') {
|
||||||
$stringtouse = 'environmentrecommendcustomcheck';
|
$stringtouse = 'environmentrecommendcustomcheck';
|
||||||
|
} else {
|
||||||
|
$stringtouse = 'environmentshouldfixcustomcheck';
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ($environment_result->getPart() == 'php_setting') {
|
} else if ($environment_result->getPart() == 'php_setting') {
|
||||||
@ -2084,7 +2086,8 @@ class core_admin_renderer extends plugin_renderer_base {
|
|||||||
if ($status) { //Handle ok result (ok)
|
if ($status) { //Handle ok result (ok)
|
||||||
$status = get_string('statusok');
|
$status = get_string('statusok');
|
||||||
} else {
|
} else {
|
||||||
if ($environment_result->getLevel() == 'optional') {//Handle check result (warning)
|
// Handle check result (warning).
|
||||||
|
if (in_array($environment_result->getLevel(), ['optional', 'recommended'])) {
|
||||||
$status = get_string('check');
|
$status = get_string('check');
|
||||||
$warningline = true;
|
$warningline = true;
|
||||||
} else { //Handle error result (error)
|
} else { //Handle error result (error)
|
||||||
|
@ -606,6 +606,7 @@ $string['environmentrequirecustomcheck'] = 'this test must pass';
|
|||||||
$string['environmentrequireinstall'] = 'must be installed and enabled';
|
$string['environmentrequireinstall'] = 'must be installed and enabled';
|
||||||
$string['environmentrequireversion'] = 'version {$a->needed} is required and you are running {$a->current}';
|
$string['environmentrequireversion'] = 'version {$a->needed} is required and you are running {$a->current}';
|
||||||
$string['environmentsettingok'] = 'recommended setting detected';
|
$string['environmentsettingok'] = 'recommended setting detected';
|
||||||
|
$string['environmentshouldfixcustomcheck'] = 'should be enabled for best results';
|
||||||
$string['environmentshouldfixsetting'] = 'PHP setting should be changed.';
|
$string['environmentshouldfixsetting'] = 'PHP setting should be changed.';
|
||||||
$string['environmentxmlerror'] = 'Error reading environment data ({$a->error_code})';
|
$string['environmentxmlerror'] = 'Error reading environment data ({$a->error_code})';
|
||||||
$string['environmentmariadbwrongdbtype'] = 'Wrong $CFG->dbtype. You need to change it in your config.php file from \'mysqli\' to \'mariadb\'.';
|
$string['environmentmariadbwrongdbtype'] = 'Wrong $CFG->dbtype. You need to change it in your config.php file from \'mysqli\' to \'mariadb\'.';
|
||||||
|
@ -1251,7 +1251,7 @@ class environment_results {
|
|||||||
*/
|
*/
|
||||||
var $error_code;
|
var $error_code;
|
||||||
/**
|
/**
|
||||||
* @var string required/optional
|
* @var string required/optional/recommended.
|
||||||
*/
|
*/
|
||||||
var $level;
|
var $level;
|
||||||
/**
|
/**
|
||||||
@ -1548,8 +1548,9 @@ function get_level($element) {
|
|||||||
$level = 'required';
|
$level = 'required';
|
||||||
if (isset($element['@']['level'])) {
|
if (isset($element['@']['level'])) {
|
||||||
$level = $element['@']['level'];
|
$level = $element['@']['level'];
|
||||||
if (!in_array($level, array('required', 'optional'))) {
|
if (!in_array($level, ['required', 'optional', 'recommended'])) {
|
||||||
debugging('The level of a check in the environment.xml file must be "required" or "optional".', DEBUG_DEVELOPER);
|
debugging('The level of a check in the environment.xml file must be "required", "optional" or "recommended".',
|
||||||
|
DEBUG_DEVELOPER);
|
||||||
$level = 'required';
|
$level = 'required';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user