Commit 4f881ed9 authored by Christopher Tombleson's avatar Christopher Tombleson Committed by Melissa Draper
Browse files

Fix "Creating default object from empty value" errors



PHP 5.4 doesnt like creating objects on the fly.

Change-Id: Ia2ba74bcf454d58e7b526fa0c1aff64f2ad71f59
Signed-off-by: default avatarChristopher Tombleson <christopher@catalyst.net.nz>
parent 2656fb12
......@@ -609,6 +609,7 @@ abstract class ArtefactTypeFileBase extends ArtefactType {
$ownerkey = $artefact->owner . '::' . $artefact->group . '::' . $artefact->institution;
if (!isset($folderdata[$ownerkey])) {
$ownersql = artefact_owner_sql($artefact->owner, $artefact->group, $artefact->institution);
$folderdata[$ownerkey] = new stdClass();
$folderdata[$ownerkey]->data = get_records_select_assoc('artefact', "artefacttype='folder' AND $ownersql", array(), '', 'id, title, parent');
if ($artefact->group) {
$folderdata[$ownerkey]->ownername = get_field('group', 'name', 'id', $artefact->group) . ':';
......
......@@ -886,17 +886,21 @@ function set_config($key, $value) {
function get_config_plugin($plugintype, $pluginname, $key) {
global $CFG;
$CFG->plugin = new StdClass;
// Suppress NOTICE with @ in case $key is not yet cached
@$value = $CFG->plugin->{$plugintype}->{$pluginname}->{$key};
if (isset($CFG->plugin->{$plugintype})) {
return $value;
}
$CFG->plugin = new stdClass();
$CFG->plugin->{$plugintype} = new StdClass;
$records = get_records_array($plugintype . '_config');
if (!empty($records)) {
foreach($records as $record) {
$CFG->plugin->{$plugintype}->{$record->plugin} = new stdClass();
$CFG->plugin->{$plugintype}->{$record->plugin}->{$record->field} = $record->value;
if ($record->field == $key && $record->plugin == $pluginname) {
$value = $record->value;
......@@ -925,6 +929,7 @@ function set_config_plugin($plugintype, $pluginname, $key, $value) {
$status = insert_record($table, $pconfig);
}
if ($status) {
$CFG->plugin->{$plugintype}->{$pluginname} = new stdClass();
$CFG->plugin->{$plugintype}->{$pluginname}->{$key} = $value;
return true;
}
......
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