MDL-79221 core_completion: Do not update state for disabled plugins

This commit is contained in:
Philipp Memmel
2025-12-12 06:43:00 +01:00
parent f878d036dd
commit 9af25198fd
2 changed files with 40 additions and 9 deletions
+9 -1
View File
@@ -573,7 +573,15 @@ class completion_info {
*/
public function update_state($cm, $possibleresult=COMPLETION_UNKNOWN, $userid=0,
$override = false, $isbulkupdate = false) {
global $USER;
global $DB, $USER;
// Do nothing if the mod plugin type is disabled.
$manager = \core_plugin_manager::resolve_plugininfo_class('mod');
$modname = !empty($cm->modname) ? $cm->modname : $DB->get_field('modules', 'name', ['id' => $cm->module]);
$enabled = $manager::get_enabled_plugin($modname);
if (!$enabled) {
return;
}
// Do nothing if completion is not enabled for that activity
if (!$this->is_enabled($cm)) {