Pluginsupported is not supported.

Pluginsupported is not supported.

by Gareth J Barnard -
Number of replies: 0
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

I'm sure I saw a tweet by David Mudrák about other features in the version.php file, but I cannot currently find it.  However.... the idea got me searching and I found that there is:

$plugin->supported

where you can define an array, such as:

$plugin->supported = array(310, 310);

This then should be used to show a message like:

Collapsed topics incompatibility message.

However because in '/admin/renderer.php', method 'required_column()' the code is:

        // Check if supports is present, and $branch is not in, only if $incompatible check was ok.
        if ($plugin->pluginsupported != null && $class == 'requires-ok' && $branch != null) {
            if ($pluginman->check_explicitly_supported($plugin, $branch) == $pluginman::VERSION_NOT_SUPPORTED) {
                $out .= html_writer::div(get_string('notsupported', 'core_plugin', $branch));
            }
        }

and not:

        // Check if supports is present, and $branch is not in, only if $incompatible check was ok.
        if ($plugin->pluginsupported != null && $class == 'requires-ok text-muted' && $branch != null) {
            if ($pluginman->check_explicitly_supported($plugin, $branch) == $pluginman::VERSION_NOT_SUPPORTED) {
                $out .= html_writer::div(get_string('notsupported', 'core_plugin', $branch));
            }
        }

then the message never gets shown!  So.... how would you write a Tracker test for this and... does anybody actually use this attribute in their version.php file anyway?  And... if its only a warning and does not actually do anything to prevent the installation, then will it just be skipped by the user anyway?  It's just I'd really like it to prevent the install in the first place as I spend an inordinate amount of time supporting and investigating issues only to discover that the user is using an incompatible version of the plugin / having to ask on a report 'What version of the plugin and Moodle are you running?'.  If the code prevented the circumstance in the first place, then perhaps, just perhaps that would be one less step on the triage list.

BTW, code taken from Moodle 3.11, version 2021051700.08, release 3.11+ (Build: 20210625), just before midnight on a Friday evening (BST), 25th June 2021.

Thoughts please smile,

Gareth

Average of ratings: -