From 4561302decf4d29938b412f425893992c30d14fd Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Fri, 3 Jun 2011 12:14:39 +0200 Subject: [PATCH] MDL-20636 Prepare stuff for cleaner merging --- lib/db/upgrade.php | 52 ++++++++++++++++++++++++++++++++++++++++++++++ mod/quiz/lib.php | 2 ++ version.php | 4 ++-- 3 files changed, 56 insertions(+), 2 deletions(-) diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index c634858c5d7..7397a66874f 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -6062,6 +6062,57 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL"); upgrade_main_savepoint(true, 2011022100.01); } + if ($oldversion < 2011052300.00) { + $table = new xmldb_table('rating'); + + // Add the component field to the ratings table + upgrade_set_timeout(60 * 20); + $field = new xmldb_field('component', XMLDB_TYPE_CHAR, '100', null, XMLDB_NOTNULL, null, 'unknown', 'contextid'); + if (!$dbman->field_exists($table, $field)) { + $dbman->add_field($table, $field); + } + + // Add the ratingarea field to the ratings table + upgrade_set_timeout(60 * 20); + $field = new xmldb_field('ratingarea', XMLDB_TYPE_CHAR, '50', null, XMLDB_NOTNULL, null, 'unknown', 'component'); + if (!$dbman->field_exists($table, $field)) { + $dbman->add_field($table, $field); + } + + upgrade_main_savepoint(true, 2011052300.00); + } + + if ($oldversion < 2011052300.01) { + + // Define index uniqueuserrating (unique) to be added to rating + $table = new xmldb_table('rating'); + $index = new xmldb_index('uniqueuserrating', XMLDB_INDEX_NOTUNIQUE, array('component', 'ratingarea', 'contextid', 'itemid')); + + // Conditionally launch add index uniqueuserrating + if (!$dbman->index_exists($table, $index)) { + $dbman->add_index($table, $index); + } + + // Main savepoint reached + upgrade_main_savepoint(true, 2011052300.01); + } + + if ($oldversion < 2011052300.02) { + + // Define index itemid (not unique) to be dropped form rating + $table = new xmldb_table('rating'); + $index = new xmldb_index('itemid', XMLDB_INDEX_NOTUNIQUE, array('itemid')); + + // Conditionally launch drop index itemid + if ($dbman->index_exists($table, $index)) { + $dbman->drop_index($table, $index); + } + + // Main savepoint reached + upgrade_main_savepoint(true, 2011052300.02); + } + + // Question engine 2 changes (14) start here if ($oldversion < 2011051200) { // Changing the default of field penalty on table question to 0.3333333 $table = new xmldb_table('question'); @@ -6428,6 +6479,7 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL"); // Main savepoint reached upgrade_main_savepoint(true, 2011051213); } + // Question engine 2 changes (14) end here return true; } diff --git a/mod/quiz/lib.php b/mod/quiz/lib.php index 39b507e09a9..f919522b235 100644 --- a/mod/quiz/lib.php +++ b/mod/quiz/lib.php @@ -673,6 +673,8 @@ function quiz_grade_item_delete($quiz) { /** * Returns an array of users who have data in a given quiz * + * @todo: deprecated - to be deleted in 2.2 + * * @param int $quizid the quiz id. * @return array of userids. */ diff --git a/version.php b/version.php index 05687658177..caaa6ff2258 100644 --- a/version.php +++ b/version.php @@ -30,10 +30,10 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2011051213.00; // YYYYMMDD = weekly release date of this DEV branch +$version = 2011060200.00; // YYYYMMDD = weekly release date of this DEV branch // RR = release increments - 00 in DEV branches // .XX = incremental changes -$release = '2.1dev (Build: 20110511)'; // Human-friendly version name +$release = '2.1dev (Build: 20110602)'; // Human-friendly version name $maturity = MATURITY_ALPHA; // this version's maturity level