Without the patch a course would not be created if it contained
an enrolment method column with an empty value. e.g.:
shortname,fullname,category,enrolment_1,enrolment_1_disable
courserestored,Course restored,1,,
courserestored2,Course restored 2,manual,1
if (!empty($enrolmethods)) {
$enrolmentplugins = self::get_enrolment_plugins();
foreach ($enrolmethods as $key => $method) {
- if (!array_key_exists($method, $enrolmentplugins)) {
+ if (empty($method)) {
+ // The enrolment method is not specified, we skip it.
+ continue;
+ } else if (!array_key_exists($method, $enrolmentplugins)) {
// Unknown enrolment method.
$unknownmethods[] = $method;
continue;
'enrolment_5_test2' => 'test2',
'enrolment_5_test1' => 'test1',
'enrolment_5' => 'flatfile',
+ 'enrolment_6' => '',
);
$expected = array(
'self' => array(