Skip to content

Commit

Permalink
Merge branch 'release/2.0.9'
Browse files Browse the repository at this point in the history
* release/2.0.9:
  fix(upgrade): Removed old indices (for legacy installations of the plugin).
  • Loading branch information
Daniel Nolte committed Feb 29, 2024
2 parents e5d579b + 815e5fa commit dd7259d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Changelog ##

- [2.0.9]:
- Removed old indices (for legacy installations of the plugin).

- [2.0.8]:
- Activity completion for views now possible.
- Small last bugfixes.
Expand Down
16 changes: 14 additions & 2 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,19 @@ function xmldb_exammanagement_upgrade($oldversion) {
// Documentation for the XMLDB Editor can be found at:
// https://docs.moodle.org/dev/XMLDB_editor.

if ($oldversion < 2024022300) { // Remove legacy field for plugininstanceid.
if ($oldversion < 2024022900) { // Remove legacy field for plugininstanceid.

// Define field plugininstanceid to be removed to exammanagement_participants.
$table = new xmldb_table('exammanagement_participants');
$field = new xmldb_field('plugininstanceid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);

$index = new xmldb_index('plugininstanceid', XMLDB_INDEX_NOTUNIQUE, ['plugininstanceid']);

// Conditionally launch remove index.
if ($dbman->index_exists($table, $index)) {
$dbman->drop_index($table, $index);
}

// Conditionally launch remove field.
if ($dbman->field_exists($table, $field)) {
$dbman->drop_field($table, $field);
Expand All @@ -55,12 +62,17 @@ function xmldb_exammanagement_upgrade($oldversion) {
// Define field plugininstanceid to be removed to exammanagement.
$table = new xmldb_table('exammanagement_temp_part');

// Conditionally launch remove index.
if ($dbman->index_exists($table, $index)) {
$dbman->drop_index($table, $index);
}

// Conditionally launch remove field.
if ($dbman->field_exists($table, $field)) {
$dbman->drop_field($table, $field);
}

upgrade_mod_savepoint(true, 2024022300, 'exammanagement');
upgrade_mod_savepoint(true, 2024022900, 'exammanagement');
}

return true;
Expand Down
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();

$plugin->component = 'mod_exammanagement'; // Full name of the plugin (used for diagnostics).
$plugin->release = '2.0.8'; // User-friendly version number.
$plugin->version = 2024022800; // The current module version (Date: YYYYMMDDXX).
$plugin->release = '2.0.9'; // User-friendly version number.
$plugin->version = 2024022900; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2020061500; // Requires this Moodle version.
$plugin->maturity = MATURITY_STABLE;

0 comments on commit dd7259d

Please sign in to comment.