-
Improvement
-
Resolution: Fixed
-
Minor
-
3.2.1
-
MOODLE_32_STABLE
-
MOODLE_33_STABLE
-
MDL-57896-master-clicfg -
- Make sure all the examples from the usage instructions work as expected.
- Play with the script to check it works as expected.
There are situations when we need to get/set moodle configuration variables from external scripts, most notably shell scripts, in a clean way. I've seen various hackery, such as text parsing of version.php or config.php, just to get access to elementary $CFG data (such as DB access credentials or dataroot path).
Another typical example is the issue with mdk where we would benefit from the ability to set the site theme without hard-coding it in config.php - https://github.com/FMCorz/mdk/issues/147
Automated post-installation scripts could profit of the ability to configure the site, too.
It was discussed today in the telegram devchat https://moodle.org/local/chatlogs/index.php?conversationid=20351#c618745 and concluded that we basically need a simple CLI wrapper around the core get_config() and set_config() functions.