oliviervalentin / moodle-mod_stickynotes

Sticky Notes is a Moodle activity for creating an interactive post-it wall. Students can create, move and vote for notes, under supervision of teacher which can define colors, lock fucntionnalities...
Other
4 stars 6 forks source link

Fix Upgrade file and remove buggy classe #16

Closed reseaucanope closed 2 years ago

reseaucanope commented 2 years ago

Fix some coding error in the upgrade file. Removing a broken class

oliviervalentin commented 2 years ago

Hello Canopé ! Merci pour ce retour / thanks for your return ! :)

Concerning broken class : indeed, it's useless... I will merge this modification.

Concerning upgrade file : new upgrade point should be 2021110404, no ? I studied other upgrade files in other Moodle plugins, last upgrade point must be the same as in version.php file. Are you ok on this ? But I understood what you mean : upgrade point should be at the end of code every time I had "if ($oldversion < xxxx...".

Olivier

reseaucanope commented 2 years ago

Hi, The upgrade savepoint have to be in a "if" and the version have to be the same. Each if have to be in a chronological order

Below is an example of the correct way to do and upgrade file

if ($oldversion < 2021110403) {
  // upgrade code
  upgrade_mod_savepoint(true, 2021110403, 'stickynotes');
}
if ($oldversion < 2021110404) {
  // upgrade code
  upgrade_mod_savepoint(true, 2021110404, 'stickynotes');
}

Every upgrade.php files are made like this, you can use the official plugin as an example like the mod_forum activity.

oliviervalentin commented 2 years ago

OK understood. I must just make a modification, for the plugin is now in 2021110404 version. I commit your changes, and will juste change a detail in the upgrade.php code.