MDL-36580 backup: Avoid PHP notice restoring old backups

Before this implementation, both resourcekey and password
were not being included in the backups, so old backups are
missing them. To keep upwards compatibility and avoid a PHP
Notice (undefined property), existence is checked via isset(),
that is the usual way all over the restore process.
This commit is contained in:
Eloy Lafuente (stronk7) 2017-10-24 22:49:10 +02:00
parent 059079e945
commit 984470d8a1

View File

@ -89,8 +89,8 @@ class restore_lti_activity_structure_step extends restore_activity_structure_ste
// Try to decrypt resourcekey and password. Null if not possible (DB default).
// Note these fields were originally encrypted on backup using {link @encrypted_final_element}.
$data->resourcekey = $this->decrypt($data->resourcekey);
$data->password = $this->decrypt($data->password);
$data->resourcekey = isset($data->resourcekey) ? $this->decrypt($data->resourcekey) : null;
$data->password = isset($data->password) ? $this->decrypt($data->password) : null;
$newitemid = $DB->insert_record('lti', $data);