mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-61984 mod_chat: Do not assume context passed is one of chat
This commit is contained in:
parent
d11786cee3
commit
2b25b67ea1
@ -167,7 +167,12 @@ class provider implements
|
||||
return;
|
||||
}
|
||||
|
||||
$chatid = get_coursemodule_from_id('chat', $context->instanceid, 0, false, MUST_EXIST)->instance;
|
||||
$cm = get_coursemodule_from_id('chat', $context->instanceid);
|
||||
if (!$cm) {
|
||||
return;
|
||||
}
|
||||
|
||||
$chatid = $cm->instance;
|
||||
$DB->delete_records_select('chat_messages', 'chatid = :chatid', ['chatid' => $chatid]);
|
||||
$DB->delete_records_select('chat_messages_current', 'chatid = :chatid', ['chatid' => $chatid]);
|
||||
$DB->delete_records_select('chat_users', 'chatid = :chatid', ['chatid' => $chatid]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user