vfremaux / moodle-local_vflibs

Complementary libraries for all VF serie plugins
0 stars 4 forks source link

Upgrade of $plugin->supported declaration to Moodle 3.11.3 #3

Open michaliskambi opened 3 years ago

michaliskambi commented 3 years ago

Trying to install in the latest Moodle 3.11.3 complains that

Incorrect syntax in plugin supported declaration in vflibs

Looking at Moodle source code, the $plugin->supported in version.php must really be 2 integers. Moodle checks it (in lib/classes/plugininfo/base.php) like this:

if (isset($plugin->supported)) {
    // Checks for structure of supported.
    $isint = (is_int($plugin->supported[0]) && is_int($plugin->supported[1]));
    $isrange = ($plugin->supported[0] <= $plugin->supported[1] && count($plugin->supported) == 2);

    if (is_array($plugin->supported) && $isint && $isrange) {
    $this->pluginsupported = $plugin->supported;
    } else {
    throw new coding_exception('Incorrect syntax in plugin supported declaration in '."$this->name");
    }
}

Fix seems to be just to update version.php from

$plugin->supported = [38];

->

$plugin->supported = [38, 38];