enrol/ldap: MDL-13952 Don't auto create courses if auto creation not enabled.

Merged from MOODLE_18_STABLE
This commit is contained in:
Inaki 2009-11-04 21:00:58 +00:00
parent d804f9e29f
commit c757ef825b

View File

@ -210,6 +210,11 @@ function sync_enrolments($type, $enrol = false) {
$course_obj = false;
$course_obj = $DB->get_record('course', array($this->enrol_localcoursefield=>$idnumber));
if (!is_object($course_obj)) {
if (empty($CFG->enrol_ldap_autocreate)) { // autocreation not allowed
print "[ENROL_LDAP] Course $idnumber does not exist, skipping\n";
continue; // next foreach course
}
// ok, now then let's create it!
print "Creating Course $idnumber...";
$newcourseid = $this->create_course($course, true); // we are skipping fix_course_sortorder()