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:
@@ -36,12 +36,18 @@ function xmldb_scorm_upgrade($oldversion) {
|
||||
/// Launch add field whatgrade
|
||||
if (!$dbman->field_exists($table,$field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
/// fix bad usage of whatgrade/grading method.
|
||||
$scorms = $DB->get_records('scorm');
|
||||
foreach ($scorms as $scorm) {
|
||||
$scorm->whatgrade = $scorm->grademethod/10;
|
||||
$DB->update_record('scorm', $scorm);
|
||||
$whatgradefixed = get_config('scorm', 'whatgradefixed');
|
||||
if (empty($whatgradefixed)) {
|
||||
/// fix bad usage of whatgrade/grading method.
|
||||
$scorms = $DB->get_records('scorm');
|
||||
foreach ($scorms as $scorm) {
|
||||
$scorm->whatgrade = $scorm->grademethod/10;
|
||||
$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');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user