mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-78025 question: move hiding logic into question_delete_question
This logic belongs in the API, so it is applied consistently. Also this avoids calling the expensive function questions_in_use twice per question.
This commit is contained in:
parent
ae4efa96ee
commit
8e1583455e
2 changed files with 5 additions and 7 deletions
|
@ -83,12 +83,7 @@ if ($deleteselected && ($confirm = optional_param('confirm', '', PARAM_ALPHANUM)
|
|||
foreach ($questionlist as $questionid) {
|
||||
$questionid = (int)$questionid;
|
||||
question_require_capability_on($questionid, 'edit');
|
||||
if (questions_in_use(array($questionid))) {
|
||||
$DB->set_field('question_versions', 'status',
|
||||
\core_question\local\bank\question_version_status::QUESTION_STATUS_HIDDEN, ['questionid' => $questionid]);
|
||||
} else {
|
||||
question_delete_question($questionid);
|
||||
}
|
||||
question_delete_question($questionid);
|
||||
}
|
||||
}
|
||||
redirect($returnurl);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue