From a457b85eb232eb0578c5054864404f6a9a68f74a Mon Sep 17 00:00:00 2001 From: cperves Date: Thu, 27 May 2021 11:39:31 +0200 Subject: [PATCH] MDL-71778 admin: patch for hard-set check filter --- admin/cli/cfg.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/admin/cli/cfg.php b/admin/cli/cfg.php index 35045ca96f1..f7d3198731d 100644 --- a/admin/cli/cfg.php +++ b/admin/cli/cfg.php @@ -120,7 +120,14 @@ if ($options['unset'] || $options['set'] !== null) { } // Check that the variable is not hard-set in the main config.php already. - if (array_key_exists($options['name'], $CFG->config_php_settings)) { + $component = $options['component']; + if (!empty($component)) { + $componentsettings = $CFG->forced_plugin_settings[$component] ?? []; + $settinginconfig = array_key_exists($options['name'], $componentsettings); + } else { + $settinginconfig = array_key_exists($options['name'], $CFG->config_php_settings); + } + if ($settinginconfig) { cli_error('The configuration variable is hard-set in the config.php, unable to change.', 4); }