MDL-47062 Grades: Add an upgrade step to warn about changes in upgrade.

Puts a notice on the grader report about the change in aggregation method
from "Sum of grades" to "Natural".

Part of: MDL-46576
This commit is contained in:
Damyon Wiese
2014-10-03 17:06:41 +08:00
committed by Adrian Greeve
parent 837b92897d
commit a9937aec06
5 changed files with 72 additions and 1 deletions
+20
View File
@@ -3903,6 +3903,26 @@ function xmldb_main_upgrade($oldversion) {
// Main savepoint reached.
upgrade_main_savepoint(true, 2014092200.01);
}
if ($oldversion < 2014100300.00) {
// Set flags so we can display a notice on all courses that might
// be affected by the uprade to natural aggregation.
if (!get_config('grades_sumofgrades_upgrade_flagged', 'core')) {
// 13 == SUM_OF_GRADES.
$sql = 'SELECT DISTINCT courseid
FROM {grade_categories}
WHERE aggregation = ?';
$courses = $DB->get_records_sql($sql, array(13));
foreach ($courses as $course) {
set_config('show_sumofgrades_upgrade_' . $course->courseid, 1);
}
set_config('grades_sumofgrades_upgrade_flagged', 1);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2014100300.00);
}
return true;
}