upgrade_main_savepoint(true, 2011011415);
}
+ if ($oldversion < 2011012400) {
+ // Clean up the old progress tracked roles setting, no longer used (replaced by enrolment)
+ unset_config('progresstrackedroles');
+ upgrade_main_savepoint(true, 2011012400);
+ }
+
if ($oldversion < 2011012500) {
-
+ $columns = $DB->get_columns('tag_instance');
+ $table = new xmldb_table('tag_instance');
+
+ // Drop and recreate index if tiuserid doesn't have default value
+ if (array_key_exists('tiuserid', $columns) && empty($columns['tiuserid']->has_default)) {
+ // Define index itemtype-itemid-tagid-tiuserid (unique) to be dropped form tag_instance
+ $index = new xmldb_index('itemtype-itemid-tagid-tiuserid', XMLDB_INDEX_UNIQUE, array('itemtype', 'itemid', 'tagid', 'tiuserid'));
+ // Conditionally launch drop index itemtype-itemid-tagid-tiuserid
+ if ($dbman->index_exists($table, $index)) {
+ $dbman->drop_index($table, $index);
+ }
+
+ // Changing the default of field tiuserid on table tag_instance to 0
+ $field = new xmldb_field('tiuserid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'itemid');
+
+ // Launch change of default for field tiuserid
+ $dbman->change_field_default($table, $field);
+
+ $index = new xmldb_index('itemtype-itemid-tagid-tiuserid', XMLDB_INDEX_UNIQUE, array('itemtype', 'itemid', 'tagid', 'tiuserid'));
+
+ // Conditionally launch add index itemtype-itemid-tagid-tiuserid
+ if (!$dbman->index_exists($table, $index)) {
+ $dbman->add_index($table, $index);
+ }
+ }
+
+ // Main savepoint reached
+ upgrade_main_savepoint(true, 2011012500);
+ }
+
++ if ($oldversion < 2011012501) {
+ //add the index userfieldidx (not unique) to user_info_data
+ $table = new xmldb_table('user_info_data');
+ $index = new xmldb_index('userfieldidx', XMLDB_INDEX_NOTUNIQUE, array('userid', 'fieldid'));
- upgrade_main_savepoint(true, 2011012500);
++
+ if (!$dbman->index_exists($table, $index)) {
+ $dbman->add_index($table, $index);
+ }
+
++ upgrade_main_savepoint(true, 2011012501);
+ }
+
return true;
}