Commit 3d2ccd76 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Cache undefined config values in get_config_plugin (bug #887400)



When a plugin config value has not been set, multiple calls to
get_config_plugin always trigger a db query.  But if it's already
queried once and found a null result, it should remember that for
next time.

Change-Id: Id955e0953131b83eba4e36face26bfb4ef828d26
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent b2e34870
......@@ -873,10 +873,12 @@ function get_config_plugin($plugintype, $pluginname, $key) {
// Suppress NOTICE with @ in case $key is not yet cached
@$value = $CFG->plugin->{$plugintype}->{$pluginname}->{$key};
if (isset($value)) {
if (isset($CFG->plugin->{$plugintype})) {
return $value;
}
$CFG->plugin->{$plugintype} = new StdClass;
$records = get_records_array($plugintype . '_config');
if (!empty($records)) {
foreach($records as $record) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment