Skip to content

Commit

Permalink
Added unset_config as a companion to set_config
Browse files Browse the repository at this point in the history
  • Loading branch information
moodler committed Sep 20, 2006
1 parent 7f7cacd commit b0270f8
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lib/moodlelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit b0270f8

Please sign in to comment.