Permalink
Browse files

get_config(): return a single value instead of a record when called w…

…ith 2 params

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.
  • Loading branch information...
1 parent 0d0f67f commit 9220fba59803dcea39723cb154c37f05d8d66911 martinlanghoff committed Jan 16, 2007
Showing with 5 additions and 2 deletions.
  1. +5 −2 lib/moodlelib.php
View
@@ -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);
}
}

0 comments on commit 9220fba

Please sign in to comment.