Adjust filter plugin validation requirements to comply with Moodle 4.5 #326
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch is addressing filter plugin validation compliance with 4.5 raised at #321. Filter API have been updated to use the standard Moodle Class Autoloading infrastructure (https://moodledev.io/docs/4.5/devupdate#filter-plugins), this introduced requirement for backward compatibility in addition to new filter class location.
Possible Moodle version compatibility options for plugins now become:
filter.php
containing classfilter_[pluginname]
.classes/text_filter.php
containing classtext_filter
.classes/text_filter.php
containing classtext_filter
and filefilter.php
containingclass_alias
.Possible Moodle versions test scenarios matrix:
The patch implements validation logic listed above and introduces 2 new methods:
getRequiredFunctionCalls
in plugin type specific Requirements class to validate that file contains function call.FileTokens::notFoundHint
can be used to give some context for validation error to improve developer experience.Currently this tool does not support the determine version compatibility declared in
version.php
($plugin->supported
), for this simple scenario I use file existence check as indicator of backward compatibility implemented in plugin, in future the tool would possibly benefit from using information from$plugin->supported
property.Changeset has been tested locally with https://github.com/gjbarnard/moodle-filter_synhi plugin:
4.5
, filter_synhimain
:4.5
, filter_synhimain
,filter.php
deleted:4.5
, filter_synhiV402.1.0
:4.4
, filter_synhiV402.1.0
:4.4
, filter_synhimain
:4.4
, filter_synhimain
,filter.php
deleted: