MDL-20636 Fix install breakage.

This commit is contained in:
Tim Hunt
2011-03-02 17:42:56 +00:00
parent beca0d8daf
commit 7916ea127e
2 changed files with 31 additions and 3 deletions
+8 -1
View File
@@ -33,10 +33,17 @@ defined('MOODLE_INTERNAL') || die();
function xmldb_quiz_statistics_install() {
global $DB;
$dbman = $DB->get_manager();
$record = new stdClass();
$record->name = 'statistics';
$record->displayorder = 8000;
$record->cron = 18000;
$record->capability = 'quiz/statistics:view';
$DB->insert_record('quiz_reports', $record);
if ($dbman->table_exists('quiz_reports')) {
$DB->insert_record('quiz_reports', $record);
} else {
$DB->insert_record('quiz_report', $record);
}
}
+23 -2
View File
@@ -74,11 +74,18 @@ function xmldb_qtype_match_upgrade($oldversion) {
// Define field correctfeedback to be added to question_match
$table = new xmldb_table('question_match');
$field = new xmldb_field('correctfeedback', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, 'shuffleanswers');
$field = new xmldb_field('correctfeedback', XMLDB_TYPE_TEXT, 'small', null, null, null, null, 'shuffleanswers');
// Conditionally launch add field correctfeedback
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
// Now fill it with '';
$DB->set_field('question_match', 'correctfeedback', '');
// Now add the not null constraint.
$field = new xmldb_field('correctfeedback', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, 'shuffleanswers');
$dbman->change_field_notnull($table, $field);
}
// match savepoint reached
@@ -104,11 +111,18 @@ function xmldb_qtype_match_upgrade($oldversion) {
// Define field partiallycorrectfeedback to be added to question_match
$table = new xmldb_table('question_match');
$field = new xmldb_field('partiallycorrectfeedback', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, 'correctfeedbackformat');
$field = new xmldb_field('partiallycorrectfeedback', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, '', 'correctfeedbackformat');
// Conditionally launch add field partiallycorrectfeedback
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
// Now fill it with '';
$DB->set_field('question_match', 'partiallycorrectfeedback', '');
// Now add the not null constraint.
$field = new xmldb_field('partiallycorrectfeedback', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, 'correctfeedbackformat');
$dbman->change_field_notnull($table, $field);
}
// match savepoint reached
@@ -139,6 +153,13 @@ function xmldb_qtype_match_upgrade($oldversion) {
// Conditionally launch add field incorrectfeedback
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
// Now fill it with '';
$DB->set_field('question_match', 'incorrectfeedback', '');
// Now add the not null constraint.
$field = new xmldb_field('incorrectfeedback', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, 'partiallycorrectfeedbackformat');
$dbman->change_field_notnull($table, $field);
}
// match savepoint reached