SCORM MDL-21568 - provide a way for checking to see if these fixes were made on the 1.9 branch already.

This commit is contained in:
Dan Marsden 2010-07-08 11:33:19 +00:00
parent c5c0d2ff98
commit b326c85a36

View file

@ -36,6 +36,8 @@ function xmldb_scorm_upgrade($oldversion) {
/// Launch add field whatgrade
if (!$dbman->field_exists($table,$field)) {
$dbman->add_field($table, $field);
$whatgradefixed = get_config('scorm', 'whatgradefixed');
if (empty($whatgradefixed)) {
/// fix bad usage of whatgrade/grading method.
$scorms = $DB->get_records('scorm');
foreach ($scorms as $scorm) {
@ -43,6 +45,10 @@ function xmldb_scorm_upgrade($oldversion) {
$DB->update_record('scorm', $scorm);
}
}
} else {
//dump this config var as it isn't needed anymore.
unset_config('whatgradefixed', 'scorm');
}
upgrade_mod_savepoint(true, 2008073000, 'scorm');
}
@ -448,12 +454,20 @@ function xmldb_scorm_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2009042002, 'scorm');
}
if ($oldversion < 2010070800) {
/// fix bad usage of whatgrade/grading method. - I hope this works in all dbs
//check to see if this has already been tidied up by a 1.9 upgrade.
$grademethodfixed = get_config('scorm', 'grademethodfixed');
if (empty($grademethodfixed)) {
/// fix bad usage of whatgrade/grading method.
$scorms = $DB->get_records('scorm');
foreach ($scorms as $scorm) {
$scorm->grademethod = $scorm->grademethod%10;
$DB->update_record('scorm', $scorm);
}
} else {
//dump this config var as it isn't needed anymore.
unset_config('grademethodfixed', 'scorm');
}
/// scorm savepoint reached
upgrade_mod_savepoint(true, 2010070800, 'scorm');
}