mirror of
https://github.com/moodle/moodle.git
synced 2025-02-20 08:05:49 +01:00
Credit: Alastair Pharo <alastair@catalyst.net.nz> 1) Some config settings have changed (ones that related specifically to teachers and students). There is a check in place however to migrate old configurations to new ones. 2) Perviously two syncs happened - one for students, one for teachers. Now sync gets called the same number of times as there are roles. Those roles that have config settings associated with them then run through all the records. This means syncing takes longer the more roles you configure (which is expected anyway I suppose).
36 lines
1000 B
PHP
Executable File
36 lines
1000 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_records('role');
|
|
foreach ($roles as $role) {
|
|
$enrol->sync_enrolments($role->shortname, true);
|
|
}
|
|
|
|
// sync metacourses
|
|
if (function_exists('sync_metacourses')) {
|
|
sync_metacourses();
|
|
}
|
|
|
|
?>
|