MDL-30951 prevent fatal error when category sync enrolment not configured

This commit is contained in:
Petr Skoda 2012-01-01 13:41:32 +01:00
parent 2117dcb591
commit c2d6b4f9ce

View File

@ -99,7 +99,9 @@ class enrol_category_handler {
// now this is going to be a bit slow, take all enrolments in child courses and verify each separately
$syscontext = get_context_instance(CONTEXT_SYSTEM);
$roles = get_roles_with_capability('enrol/category:synchronised', CAP_ALLOW, $syscontext);
if (!$roles = get_roles_with_capability('enrol/category:synchronised', CAP_ALLOW, $syscontext)) {
return true;
}
$plugin = enrol_get_plugin('category');