From: moodler Date: Wed, 20 Sep 2006 02:17:27 +0000 (+0000) Subject: Added unset_config as a companion to set_config X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=b0270f84ebfaacd7090511077f87eccacda96e1b;p=moodle.git Added unset_config as a companion to set_config --- 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.