The method detect_plugin_component() returns false or string. The
normalize_component() expects strings only. Passing false to it
(typically when the plugin does not declare its component) caused the
PHP warning.
Credit goes to Ankit Agarwal for spotting this during testing.
Previously, the acknowledgement was required only when installing
plugins from the ZIP file. It is valid when installing plugins from the
Plugins directory, too. So we display it at the validator page now to
make sure it is displayed in both cases.
There is no need to require the admin to check the acknowledgement box
now. We do not do that anywhere in admin UI (and there are more
dangerous operations than installing a plugin). Admins still can deploy
plugins manually without this tool anyway. And at the end, they are
admins. They should know what they are doing. Simply displaying the
acknowledgement message before they click the install button is enough.
Now we allow the plugin type left unselected and we attempt to
auto-detect it. Only when the auto-detection fails, the admin has to
manually select the type of the plugin.
On contrary to deeper heuristic (read: guessing) we perform in the
Plugins directory (such as looking at the names of the language files),
here we simply rely on the plugin component being correctly defined in
the version.php file.
The validator class has more robust processing, to make sure the
component declaration is not provided in a commented area of the
version.php etc. However, as it is fully acceptable that the
auto-detection fails if the version.php uses non-standard syntax, this
easier approach is valid here.
MSSQL's substring() implementation is somehow silly/strict and unable to
perform implicit casts to integer both for the start and length parameters.
This hits Moodle badly because of another problems (MDL-23997) we decided
to cast to string all bound placeholders long ago.
So this commit just enforces the cast of the start and length parameters to
integer. And includes unit tests for using placeholders on all positions in
the sql_substr() method.
Converted the SQL params within badges_get_user_badges to
named params.
Unit tests added for this function at the same time.
UI covered by behat already.