Skip to content

Commit

Permalink
Merge branch 'MDL-75752_400' of https://github.com/timhunt/moodle int…
Browse files Browse the repository at this point in the history
…o MOODLE_400_STABLE
  • Loading branch information
andrewnicols committed Oct 6, 2022
2 parents 7c46149 + 6ddf634 commit e3b8864
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
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
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 e3b8864

Please sign in to comment.