MDL-25708 recordsets - page and quiz modules
This commit is contained in:
+12
-14
@@ -51,24 +51,22 @@ function page_20_migrate() {
|
||||
|
||||
$fs = get_file_storage();
|
||||
|
||||
if ($candidates = $DB->get_recordset('resource_old', array('type'=>'html', 'migrated'=>0))) {
|
||||
foreach ($candidates as $candidate) {
|
||||
page_20_migrate_candidate($candidate, $fs, FORMAT_HTML);
|
||||
}
|
||||
$candidates->close();
|
||||
$candidates = $DB->get_recordset('resource_old', array('type'=>'html', 'migrated'=>0));
|
||||
foreach ($candidates as $candidate) {
|
||||
page_20_migrate_candidate($candidate, $fs, FORMAT_HTML);
|
||||
}
|
||||
$candidates->close();
|
||||
|
||||
if ($candidates = $DB->get_recordset('resource_old', array('type'=>'text', 'migrated'=>0))) {
|
||||
foreach ($candidates as $candidate) {
|
||||
//there might be some rubbish instead of format int value
|
||||
$format = (int)$candidate->reference;
|
||||
if ($format < 0 or $format > 4) {
|
||||
$format = FORMAT_MOODLE;
|
||||
}
|
||||
page_20_migrate_candidate($candidate, $fs, $format);
|
||||
$candidates = $DB->get_recordset('resource_old', array('type'=>'text', 'migrated'=>0));
|
||||
foreach ($candidates as $candidate) {
|
||||
//there might be some rubbish instead of format int value
|
||||
$format = (int)$candidate->reference;
|
||||
if ($format < 0 or $format > 4) {
|
||||
$format = FORMAT_MOODLE;
|
||||
}
|
||||
$candidates->close();
|
||||
page_20_migrate_candidate($candidate, $fs, $format);
|
||||
}
|
||||
$candidates->close();
|
||||
|
||||
// clear all course modinfo caches
|
||||
rebuild_course_cache(0, true);
|
||||
|
||||
+3
-2
@@ -604,7 +604,8 @@ function quiz_upgrade_grades() {
|
||||
$sql = "SELECT a.*, cm.idnumber AS cmidnumber, a.course AS courseid
|
||||
FROM {quiz} a, {course_modules} cm, {modules} m
|
||||
WHERE m.name='quiz' AND m.id=cm.module AND cm.instance=a.id";
|
||||
if ($rs = $DB->get_recordset_sql($sql)) {
|
||||
$rs = $DB->get_recordset_sql($sql);
|
||||
if ($rs->valid()) {
|
||||
$pbar = new progress_bar('quizupgradegrades', 500, true);
|
||||
$i=0;
|
||||
foreach ($rs as $quiz) {
|
||||
@@ -613,8 +614,8 @@ function quiz_upgrade_grades() {
|
||||
quiz_update_grades($quiz, 0, false);
|
||||
$pbar->update($i, $count, "Updating Quiz grades ($i/$count).");
|
||||
}
|
||||
$rs->close();
|
||||
}
|
||||
$rs->close();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user