Skip to content

Commit a434ef8

Browse files
FragoniteTomoTsuyuki
authored andcommitted
Use CONTEXT_MODULE constant in sql
1 parent fd78007 commit a434ef8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

db/upgrade.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -426,10 +426,11 @@ function xmldb_cms_upgrade($oldversion) {
426426
JOIN {cms} cms ON cms.id = cfd.instanceid
427427
JOIN {course_modules} cm ON cm.instance = cms.id
428428
JOIN {modules} m ON m.id = cm.module AND m.name = 'cms'
429-
JOIN {context} ctx ON ctx.instanceid = cm.id AND ctx.contextlevel = 70
429+
JOIN {context} ctx ON ctx.instanceid = cm.id AND ctx.contextlevel = :modulecontextlevel
430430
WHERE f.contextid = 1 AND f.component = 'customfield_textarea' AND f.filearea = 'value'";
431+
$params = ['modulecontextlevel' => CONTEXT_MODULE];
431432

432-
$records = $DB->get_recordset_sql($sql);
433+
$records = $DB->get_recordset_sql($sql, $params);
433434
foreach ($records as $record) {
434435
// Update the record with the new context id and path name hash.
435436
$record->contextid = $record->ctxid;

0 commit comments

Comments
 (0)