moodle/enrol/ldap/enrol_ldap_sync.php
tjhunt 9101efd312 cleanup: MDL-17083 Remove the old teacher, teachers, student and students columns from the course table.
For something that has been deprecated for over two years, they were still used in a lot of places!
2008-11-13 08:40:57 +00:00

36 lines
996 B
PHP
Executable File

<?php
if(!empty($_SERVER['GATEWAY_INTERFACE'])){
error_log("should not be called from apache!");
exit;
}
error_reporting(E_ALL);
require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); // global moodle config file.
require_once($CFG->dirroot . '/course/lib.php');
require_once($CFG->dirroot . '/lib/moodlelib.php');
require_once($CFG->dirroot . '/lib/datalib.php');
require_once($CFG->dirroot . "/enrol/ldap/enrol.php");
// ensure errors are well explained
$CFG->debug = DEBUG_NORMAL;
// update enrolments -- these handlers should autocreate courses if required
$enrol = new enrolment_plugin_ldap();
$enrol->enrol_ldap_connect();
$enrol->check_legacy_config();
$roles = get_all_roles();
foreach ($roles as $role) {
$enrol->sync_enrolments($role->shortname, true);
}
// sync metacourses
if (function_exists('sync_metacourses')) {
sync_metacourses();
}
?>