davosmith / moodle-checklist

Checklist plugin for Moodle - allows a teacher to create a checklist for their students to tick-off
GNU General Public License v3.0
24 stars 67 forks source link

plugin uses non existent class in Moodle below 4.2 #126

Open durzo opened 1 month ago

durzo commented 1 month ago

This is related to #114 but in a different place.

https://github.com/davosmith/moodle-checklist/blame/be6e5afa60317fdee26d48778e351c6bba748f45/locallib.php#L230 calls \core_external\util::format_text() but this was not added until Moodle 4.2 as part of MDL-76583

On Moodle prior to 4.2, you should use external_format_text() instead.

The plugin is listed as supporting Moodle back to 4.1 on https://moodle.org/plugins/mod_checklist/versions

Ideally the plugin should be broken up into different versions for each major Moodle by branches MOODLE_401_STABLE, MOODLE_403_STABLE etc like other plugins otherwise its bound to break when HQ make core api changes like this.

This bug prevents the mobile app from working, when clicking on a course activity the exception is shown instead.

davosmith commented 1 month ago

@durzo I cannot see any reason to spend time splitting the code into a separate branch in this case - the code simply needs wrapping in a call to if (class_exists(\core_external\util::class)) { and provide a fallback to external_format_text() where that is not possible.

I'm not likely to have time to look at this in detail in the immediate future - I'd be happy to review / merge a pull request to fix this, if you want to open one.