Added unset_config as a companion to set_config

This commit is contained in:
moodler
2006-09-20 02:17:27 +00:00
parent 7f7cacdf4e
commit b0270f84eb
+21
View File
@@ -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.