Permalink
Browse files

Adding fix for idnumber duplication problem in restoring from backup …

  • Loading branch information...
1 parent 30060fe commit 44b052de61ebd6aad8329a71e5bb3dfabc0f53ad mjollnir_ committed Dec 17, 2004
Showing with 6 additions and 0 deletions.
  1. +4 −0 backup/restore_execute.html
  2. +1 −0 backup/restorelib.php
  3. +1 −0 lang/en/moodle.php
@@ -64,6 +64,7 @@
//Saving conversion id variables into backup_tables
if ($restore->restoreto == 2) {
echo "<li>".get_string("creatingnewcourse");
+ $oldidnumber = $course_header->course_idnumber;
if (!$status = restore_create_new_course($restore,$course_header)) {
notify("Error while creating the new empty course.");
}
@@ -72,6 +73,9 @@
echo "<ul>";
echo "<li>".$course_header->course_fullname." (".$course_header->course_shortname.")";
echo "<li>".get_string("category").": ".$course_header->category->name;
+ if (!empty($oldidnumber)) {
+ echo "<li>".get_string("nomoreidnumber","moodle",$oldidnumber)."</li>";
+ }
echo "</ul>";
//Put the destination course_id
$restore->course_id = $course_header->course_id;
View
@@ -518,6 +518,7 @@ function restore_create_new_course($restore,&$course_header) {
$course->fullname = addslashes($course_header->course_fullname);
$course->shortname = addslashes($course_header->course_shortname);
$course->idnumber = addslashes($course_header->course_idnumber);
+ $course->idnumber = ''; //addslashes($course_header->course_idnumber); // we don't want this at all.
$course->summary = restore_decode_absolute_links(addslashes($course_header->course_summary));
$course->format = addslashes($course_header->course_format);
$course->showgrades = addslashes($course_header->course_showgrades);
View
@@ -767,6 +767,7 @@
$string['nograde'] = 'No grade';
$string['noimagesyet'] = 'No images have been uploaded to your course yet';
$string['nomorecourses'] = 'No more matching courses could be found';
+$string['nomoreidnumber'] = 'Not using an idnumber to avoid collisions';
$string['none'] = 'None';
$string['nopotentialadmins'] = 'No potential admins';
$string['nopotentialcreators'] = 'No potential course creators';

0 comments on commit 44b052d

Please sign in to comment.