-
Bug
-
Resolution: Fixed
-
Blocker
-
2.3.4, 2.4.1, 2.5
-
None
-
MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
-
MOODLE_23_STABLE, MOODLE_24_STABLE
-
wip-
MDL-38378_master
MDL-38173 Introduced update code in '/lib/db/upgrade.php' which contains a hard coded database prefix:
$sql = 'SELECT s2.id, s2.course, s2.sequence
|
FROM mdl_course_sections s2
|
JOIN(
|
SELECT DISTINCT s.id
|
FROM
|
{course_modules} cm
|
JOIN {course_sections} s
|
ON
|
cm.course = s.course
|
WHERE cm.section != s.id AND ' . $sequenceconcat . ' LIKE ' . $moduleconcat . '
|
) d
|
ON s2.id = d.id';
|
$coursesections = $DB->get_recordset_sql($sql);
|
This means that if the database prefix is not 'mdl_' then an error occurs and the upgrade fails:
Debug info: Table 'moodlegjb.mdl_course_sections' doesn't exist
|
SELECT s2.id, s2.course, s2.sequence
|
FROM mdl_course_sections s2
|
JOIN(
|
SELECT DISTINCT s.id
|
FROM
|
mdl23_course_modules cm
|
JOIN mdl23_course_sections s
|
ON
|
cm.course = s.course
|
WHERE cm.section != s.id AND CONCAT(',', s.sequence, ',') LIKE CONCAT('%,', cm.id, ',%')
|
) d
|
ON s2.id = d.id
|
[array (
|
)]
|
Error code: dmlreadexception
|
Stack trace:
|
line 407 of \lib\dml\moodle_database.php: dml_read_exception thrown
|
line 903 of \lib\dml\mysqli_native_moodle_database.php: call to moodle_database->query_end()
|
line 1091 of \lib\db\upgrade.php: call to mysqli_native_moodle_database->get_recordset_sql()
|
line 1480 of \lib\upgradelib.php: call to xmldb_main_upgrade()
|
line 275 of \admin\index.php: call to upgrade_core()
|
The workaround is to manually edit 'upgrade.php' and change the prefix.