Merge branch 'master' of github.com:DAViCal/davical into github
[davical.git] / scripts / cron-sync-ldap.php
blobae9be7e6e5a3f6fd3ae21693b2ab0ef31ce9f33d
1 #!/usr/bin/env php
2 <?php
3 /**
4 * Script to sync user data from an LDAP server
5 */
6 $script_file = __FILE__;
7 if ( $argc < 2 ) {
9 echo <<<USAGE
10 Usage:
12 $script_file davical.example.com
14 Where 'davical.example.com' is the hostname of your DAViCal server.
16 This script can be used to synchronise DAViCal from your LDAP server on a regular
17 basis to ensure group information is up-to-date. It's not strictly necessary as
18 DAViCal's user data will be updated as soon as a new or updated user logs into
19 DAViCal, but it can be useful to synchronise data for people who have not logged
20 into DAViCal so that they are visible as potential calendars, for example.
22 USAGE;
23 exit(1);
26 $_SERVER['SERVER_NAME'] = $argv[1];
28 chdir(str_replace('/scripts/cron-sync-ldap.php','/htdocs',$script_file));
30 require_once("./always.php");
32 sync_LDAP();
33 sync_LDAP_groups();