fixed category sync cleanup

This commit is contained in:
Petr Skoda 2010-09-17 12:35:22 +00:00
parent 894843b465
commit ac86edd01a

View file

@ -250,7 +250,9 @@ function enrol_category_sync_full() {
if (!$roles = get_roles_with_capability('enrol/category:synchronised', CAP_ALLOW, $syscontext)) { if (!$roles = get_roles_with_capability('enrol/category:synchronised', CAP_ALLOW, $syscontext)) {
// yay, nothing to do, so let's remove all leftovers // yay, nothing to do, so let's remove all leftovers
if ($instances = $DB->get_records('enrol', array('enrol'=>'category'))) { if ($instances = $DB->get_records('enrol', array('enrol'=>'category'))) {
$plugin->delete_instance($instance); foreach ($instances as $instance) {
$plugin->delete_instance($instance);
}
} }
} }