MDL-78025 questions: questions_in_use should check question_references
This avoids the needs for plugins to do separate queries, which is easier for them, and better performing.
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
*/
|
||||
|
||||
use core_question\local\bank\question_version_status;
|
||||
use core_question\question_reference_manager;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
@@ -123,6 +124,10 @@ function questions_in_use($questionids): bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (question_reference_manager::questions_with_references($questionids)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if any plugins are using these questions.
|
||||
$callbacksbytype = get_plugins_with_function('questions_in_use');
|
||||
foreach ($callbacksbytype as $callbacks) {
|
||||
|
||||
Reference in New Issue
Block a user