]> git.mjollnir.org Git - moodle.git/commitdiff
Added unset_config as a companion to set_config
authormoodler <moodler>
Wed, 20 Sep 2006 02:17:27 +0000 (02:17 +0000)
committermoodler <moodler>
Wed, 20 Sep 2006 02:17:27 +0000 (02:17 +0000)
lib/moodlelib.php

index ef6b7b37d9536c82de66cb2133789f180d28b69f..8f3e5b1c93cc0cce0986ccee5437a677f52e42fa 100644 (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.