]> git.mjollnir.org Git - moodle.git/commitdiff
get_config(): return a single value instead of a record when called with 2 params
authormartinlanghoff <martinlanghoff>
Tue, 16 Jan 2007 23:25:19 +0000 (23:25 +0000)
committermartinlanghoff <martinlanghoff>
Tue, 16 Jan 2007 23:25:19 +0000 (23:25 +0000)
get_config() was meant to return a single value when called with 2 params,
however, it never did. Change it to Do The Right Thing, and audit all callers.

lib/moodlelib.php

index c18904ea8e23b7b10bce2d88dd544dee96a8d450..2112911223c690305a59903e5047b6c759a1527c 100644 (file)
@@ -601,6 +601,9 @@ function set_config($name, $value, $plugin=NULL) {
  * generating $CFG safely from the database without overwriting
  * existing values.
  *
+ * If called with 2 parameters it will return a $string single
+ * value or false of the value is not found.
+ *
  * @param string $plugin
  * @param string $name
  * @uses $CFG
@@ -613,9 +616,9 @@ function get_config($plugin=NULL, $name=NULL) {
 
     if (!empty($name)) { // the user is asking for a specific value
         if (!empty($plugin)) {
-            return get_record('config_plugins', 'plugin' , $plugin, 'name', $name);
+            return get_field('config_plugins', 'value', 'plugin' , $plugin, 'name', $name);
         } else {
-            return get_record('config', 'name', $name);
+            return get_field('config', 'value', 'name', $name);
         }
     }