Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Corrected the journal -> Assignment upgrade!!! :-(

  • Loading branch information...
commit e92893695d6529a4b42d8310c05dc5000bfd193a 1 parent fa19bf3
moodler authored
View
9 mod/assignment/type/online/db/mysql.php
@@ -42,7 +42,6 @@ function assignment_online_upgrade($oldversion) {
$assignment->id = insert_record('assignment', $assignment);
-
/// Now create a new course module record
$oldcm = get_coursemodule_from_instance('journal', $journal->id, $journal->course);
@@ -58,7 +57,13 @@ function assignment_online_upgrade($oldversion) {
/// And locate it above the old one
+ if (!$section = get_record('course_sections', 'id', $oldcm->section)) {
+ $section->section = 0; // So it goes somewhere!
+ }
+
$newcm->coursemodule = $newcm->id;
+ $newcm->section = $section->section; // need relative reference
+
if (! $sectionid = add_mod_to_section($newcm, $oldcm) ) { // Add it before Journal
error("Could not add the new course module to that section");
}
@@ -109,4 +114,6 @@ function assignment_online_upgrade($oldversion) {
}
}
+ return true;
+
}
View
9 mod/assignment/type/online/db/postgres7.php
@@ -42,7 +42,6 @@ function assignment_online_upgrade($oldversion) {
$assignment->id = insert_record('assignment', $assignment);
-
/// Now create a new course module record
$oldcm = get_coursemodule_from_instance('journal', $journal->id, $journal->course);
@@ -58,7 +57,13 @@ function assignment_online_upgrade($oldversion) {
/// And locate it above the old one
+ if (!$section = get_record('course_sections', 'id', $oldcm->section)) {
+ $section->section = 0; // So it goes somewhere!
+ }
+
$newcm->coursemodule = $newcm->id;
+ $newcm->section = $section->section; // need relative reference
+
if (! $sectionid = add_mod_to_section($newcm, $oldcm) ) { // Add it before Journal
error("Could not add the new course module to that section");
}
@@ -109,4 +114,6 @@ function assignment_online_upgrade($oldversion) {
}
}
+ return true;
+
}
Please sign in to comment.
Something went wrong with that request. Please try again.