mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
Merge branch 'MDL-75789' of https://github.com/paulholden/moodle
This commit is contained in:
commit
46114474e4
@ -1811,10 +1811,9 @@ abstract class restore_dbops {
|
||||
public static function calculate_course_names($courseid, $fullname, $shortname) {
|
||||
global $CFG, $DB;
|
||||
|
||||
$currentfullname = '';
|
||||
$currentshortname = '';
|
||||
$counter = 0;
|
||||
// Iteratere while the name exists
|
||||
|
||||
// Iterate while fullname or shortname exist.
|
||||
do {
|
||||
if ($counter) {
|
||||
$suffixfull = ' ' . get_string('copyasnoun') . ' ' . $counter;
|
||||
@ -1823,8 +1822,11 @@ abstract class restore_dbops {
|
||||
$suffixfull = '';
|
||||
$suffixshort = '';
|
||||
}
|
||||
$currentfullname = $fullname.$suffixfull;
|
||||
$currentshortname = substr($shortname, 0, 100 - strlen($suffixshort)).$suffixshort; // < 100cc
|
||||
|
||||
// Ensure we don't overflow maximum length of name fields, in multi-byte safe manner.
|
||||
$currentfullname = core_text::substr($fullname, 0, 254 - strlen($suffixfull)) . $suffixfull;
|
||||
$currentshortname = core_text::substr($shortname, 0, 100 - strlen($suffixshort)) . $suffixshort;
|
||||
|
||||
$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));
|
||||
|
Loading…
x
Reference in New Issue
Block a user