Commit 01dd4847 authored by Son Nguyen's avatar Son Nguyen Committed by Aaron Wells
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 ff97447c
...@@ -1007,10 +1007,11 @@ function get_config_plugin_instance($plugintype, $pluginid, $key) { ...@@ -1007,10 +1007,11 @@ function get_config_plugin_instance($plugintype, $pluginid, $key) {
global $CFG; global $CFG;
// Must be unlikely to exist as a config option for any plugin // 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 // 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)) { if (isset($value)) {
return $value; return $value;
} }
...@@ -1018,7 +1019,8 @@ function get_config_plugin_instance($plugintype, $pluginid, $key) { ...@@ -1018,7 +1019,8 @@ function get_config_plugin_instance($plugintype, $pluginid, $key) {
$records = get_records_array($plugintype . '_instance_config', 'instance', $pluginid, 'field', 'field, value'); $records = get_records_array($plugintype . '_instance_config', 'instance', $pluginid, 'field', 'field, value');
if (!empty($records)) { if (!empty($records)) {
foreach($records as $record) { 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) { if ($record->field == $key) {
$value = $record->value; $value = $record->value;
} }
...@@ -1056,8 +1058,9 @@ function set_config_plugin_instance($plugintype, $pluginname, $pluginid, $key, $ ...@@ -1056,8 +1058,9 @@ function set_config_plugin_instance($plugintype, $pluginname, $pluginid, $key, $
} }
if ($status) { if ($status) {
// Must be unlikely to exist as a config option for any plugin // Must be unlikely to exist as a config option for any plugin
$instance = '_i_n_s_t'.$pluginid; $instance = '_i_n_s_t' . $pluginid;
$CFG->plugin->{$plugintype}->{$pluginname}->{$instance}->{$key} = $value; $configname = "plugin_{$plugintype}_{$instance}_{$key}";
$CFG->{$configname} = $value;
return true; return true;
} }
return false; 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