Skip to content

Commit

Permalink
Merge branch 'MDL-75752' of https://github.com/timhunt/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Oct 6, 2022
2 parents 3c10b0c + 57ee14c commit 29e1f71
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,13 @@ protected function define_question_plugin_structure() {
$pluginwrapper->add_child($comments);
$comments->add_child($comment);

// Trying to pass an param (contextid) with an int value seems to have special meaning, so just inline.
// It is an int, so minimal security risk.
$comment->set_source_sql("SELECT c.*
FROM {comments} c
WHERE c.commentarea = 'question'
WHERE c.contextid = " . context_system::instance()->id . "
AND c.component = 'qbank_comment'
AND c.commentarea = 'question'
AND c.itemid = ?", [backup::VAR_PARENTID]);

$comment->annotate_ids('user', 'userid');
Expand Down
3 changes: 1 addition & 2 deletions question/bank/comment/tests/backup_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,8 @@ public function test_backup_restore() {
$question2 = $this->qgen->create_question('shortanswer', null, $this->question2data);

// Add comments to the questions.
$coursecontext = \context_course::instance($this->course->id);
$args = new \stdClass;
$args->context = $coursecontext;
$args->context = \context_system::instance();
$args->course = $this->course;
$args->area = 'question';
$args->itemid = $question1->id;
Expand Down

0 comments on commit 29e1f71

Please sign in to comment.