Commit fe9cc367 authored by Son Nguyen's avatar Son Nguyen Committed by Gerrit Code Review
Browse files

Using the new format for plugin configs. Bug 1410953



The old format caused a strict standards warning in PHP 5.5

Change-Id: I3014aae0bbdca131c63735a5daade299d11a265b
Signed-off-by: default avatarSon Nguyen <son.nguyen@catalyst.net.nz>
parent e882c380
......@@ -999,10 +999,11 @@ function get_config_plugin_instance($plugintype, $pluginid, $key) {
global $CFG;
// Must be unlikely to exist as a config option for any plugin
$instance = '_i_n_s_t'.$pluginid;
$instance = '_i_n_s_t' . $pluginid;
// Suppress NOTICE with @ in case $key is not yet cached
@$value = $CFG->plugin->{$plugintype}->{$instance}->{$key};
$configname = "plugin_{$plugintype}_{$instance}_{$key}";
@$value = $CFG->{$configname};
if (isset($value)) {
return $value;
}
......@@ -1010,7 +1011,8 @@ function get_config_plugin_instance($plugintype, $pluginid, $key) {
$records = get_records_array($plugintype . '_instance_config', 'instance', $pluginid, 'field', 'field, value');
if (!empty($records)) {
foreach($records as $record) {
$CFG->plugin->{$plugintype}->{$instance}->{$record->field} = $record->value;
$storeconfigname = "plugin_{$plugintype}_{$instance}_{$record->field}";
$CFG->{$storeconfigname} = $record->value;
if ($record->field == $key) {
$value = $record->value;
}
......@@ -1048,8 +1050,9 @@ function set_config_plugin_instance($plugintype, $pluginname, $pluginid, $key, $
}
if ($status) {
// Must be unlikely to exist as a config option for any plugin
$instance = '_i_n_s_t'.$pluginid;
$CFG->plugin->{$plugintype}->{$pluginname}->{$instance}->{$key} = $value;
$instance = '_i_n_s_t' . $pluginid;
$configname = "plugin_{$plugintype}_{$instance}_{$key}";
$CFG->{$configname} = $value;
return true;
}
return false;
......
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