mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-04-17 13:50:17 +00:00
A script that can be run from cron to sync from LDAP.
As proposed by 'mate' on IRC. This simple code hopefully also demonstrates a good general starting point to future PHP scripts running from the command-line within DAViCal.
This commit is contained in:
parent
d4e29a91b6
commit
3ce63406c8
33
scripts/cron-sync-ldap.php
Executable file
33
scripts/cron-sync-ldap.php
Executable file
@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/**
|
||||
* Script to sync user data from an LDAP server
|
||||
*/
|
||||
$script_file = __FILE__;
|
||||
if ( $argc < 2 ) {
|
||||
|
||||
echo <<<USAGE
|
||||
Usage:
|
||||
|
||||
$script_file davical.example.com
|
||||
|
||||
Where 'davical.example.com' is the hostname of your DAViCal server.
|
||||
|
||||
This script can be used to synchronise DAViCal from your LDAP server on a regular
|
||||
basis to ensure group information is up-to-date. It's not strictly necessary as
|
||||
DAViCal's user data will be updated as soon as a new or updated user logs into
|
||||
DAViCal, but it can be useful to synchronise data for people who have not logged
|
||||
into DAViCal so that they are visible as potential calendars, for example.
|
||||
|
||||
USAGE;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$_SERVER['SERVER_NAME'] = $argv[1];
|
||||
|
||||
chdir(str_replace('/scripts/cron-sync-ldap.php','/htdocs',$script_file));
|
||||
|
||||
require_once("./always.php");
|
||||
|
||||
sync_LDAP();
|
||||
sync_LDAP_groups();
|
||||
Loading…
x
Reference in New Issue
Block a user