From b0270f84ebfaacd7090511077f87eccacda96e1b Mon Sep 17 00:00:00 2001 From: moodler Date: Wed, 20 Sep 2006 02:17:27 +0000 Subject: [PATCH] Added unset_config as a companion to set_config --- lib/moodlelib.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index ef6b7b37d9..8f3e5b1c93 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -562,6 +562,27 @@ function get_config($plugin=NULL, $name=NULL) { } } +/** + * Removes a key from global configuration + * + * @param string $name the key to set + * @param string $plugin (optional) the plugin scope + * @uses $CFG + * @return bool + */ +function unset_config($name, $plugin=NULL) { + + global $CFG; + + unset($CFG->$name); + + if (empty($plugin)) { + return delete_records('config', 'name', $name); + } else { + return delete_records('config_plugins', 'name', $name, 'plugin', $plugin); + } +} + /** * Refresh current $USER session global variable with all their current preferences. -- 2.39.5