Skip to content

Commit

Permalink
StudentQuiz: improve upgrade steps with new function #814045
Browse files Browse the repository at this point in the history
  • Loading branch information
Khoa Nguyen authored and timhunt committed Aug 16, 2024
1 parent ecd900c commit c845395
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions backup/moodle2/restore_studentquiz_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,7 @@ protected function process_notification($data) {

if (json_decode($data->content) === null) {
// Older versions of StudentQuiz stored this data serialised. We no longer support that.
// Such data is not restored. At worse, this leads to some lost notifications for users
// who have chosen to receive a digest, but to people want notifications relating to restored data?
return;
$data = json_encode(unserialize_object($data->content));
}

$DB->insert_record('studentquiz_notification', $data);
Expand Down
2 changes: 1 addition & 1 deletion db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -1739,7 +1739,7 @@ function xmldb_studentquiz_upgrade($oldversion) {
$count++;

$DB->set_field('studentquiz_notification',
'content', json_encode(unserialize($notification->content)),
'content', json_encode(unserialize_object($notification->content)),
['id' => $notification->id]);
}
$progressbar->update($count, $total, "Update the state for question - {$count}/{$total} - DONE!");
Expand Down

0 comments on commit c845395

Please sign in to comment.