Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: 2.1.7, 2.2, 2.2.1, 2.2.5, 2.3.2
-
Component/s: Backup
-
Testing Instructions:
-
Difficulty:Easy
-
Affected Branches:MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE
-
Fixed Branches:MOODLE_22_STABLE, MOODLE_23_STABLE
-
Pull from Repository:
-
Pull Master Branch:
MDL-34837-master -
Pull Master Diff URL:
Description
There is an error in method for generating new temporary name for a restored course. Method is located in
<moodle>/backup/util/dbops/restore_dbops.class.php
restore_dbops::calculate_course_names
|
That method uses
$DB->get_record_select
|
Which throws exception if query returns more than one record and debugging is turned on. It does not break anything but it annoys suspicious users(clients).
Quick fix would be to change these lines:
$coursefull = $DB->get_record_select('course', 'fullname = ? AND id != ?', array($currentfullname, $courseid));
|
$courseshort = $DB->get_record_select('course', 'shortname = ? AND id != ?', array($currentshortname, $courseid));
|
To:
$coursefull = $DB->get_record_select('course', 'fullname = ? AND id != ?', array($currentfullname, $courseid), IGNORE_MULTIPLE);
|
$courseshort = $DB->get_record_select('course', 'shortname = ? AND id != ?', array($currentshortname, $courseid), IGNORE_MULTIPLE);
|