Automatic installer.php lang files by installer_builder (20080621)
[moodle.git] / auth / ldap / auth_ldap_sync_users.php
blob1696b1283072311b507ba19e671810a5e03a5fdc
1 <?php
2 /** auth_ldap_sync_users.php
3 *
4 * This script is meant to be called from a cronjob to sync moodle with the LDAP
5 * backend in those setups where the LDAP backend acts as 'master'.
6 *
7 * Recommended cron entry:
8 * # 5 minutes past 4am
9 * 5 4 * * * /usr/bin/php -c /etc/php4/cli/php.ini /var/www/moodle/auth/ldap/auth_ldap_sync_users.php
11 * Notes:
12 * - If you have a large number of users, you may want to raise the memory limits
13 * by passing -d momory_limit=256M
14 * - For debugging & better logging, you are encouraged to use in the command line:
15 * -d log_errors=1 -d error_reporting=E_ALL -d display_errors=0 -d html_errors=0
17 * Performance notes:
18 * We have optimized it as best as we could for Postgres and mySQL, with 27K students
19 * we have seen this take 10 minutes.
24 if(!empty($_SERVER['GATEWAY_INTERFACE'])){
25 error_log("should not be called from apache!");
26 exit;
29 require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); // global moodle config file.
31 require_once($CFG->dirroot.'/course/lib.php');
32 require_once($CFG->dirroot.'/lib/blocklib.php');
33 require_once($CFG->dirroot.'/mod/resource/lib.php');
34 require_once($CFG->dirroot.'/auth/ldap/lib.php');
35 require_once($CFG->dirroot.'/mod/forum/lib.php');
36 $CFG->debug=10;
37 auth_sync_users(1000, true );