Merge branch 'MDL-40370_25' of git://github.com/timhunt/moodle into MOODLE_25_STABLE

This commit is contained in:
Eloy Lafuente (stronk7)
2013-07-01 18:02:51 +02:00
+19
View File
@@ -39,6 +39,25 @@ function xmldb_qtype_shortanswer_upgrade($oldversion) {
// Moodle v2.4.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2013011799) {
// Find duplicate rows before they break the 2013011803 step below.
$problemids = $DB->get_recordset_sql("
SELECT question, MIN(id) AS recordidtokeep
FROM {question_shortanswer}
GROUP BY question
HAVING COUNT(1) > 1
");
foreach ($problemids as $problem) {
$DB->delete_records_select('question_shortanswer',
'question = ? AND id > ?',
array($problem->question, $problem->recordidtokeep));
}
$problemids->close();
// Shortanswer savepoint reached.
upgrade_plugin_savepoint(true, 2013011799, 'qtype', 'shortanswer');
}
if ($oldversion < 2013011800) {
// Define field answers to be dropped from question_shortanswer.