mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 17:33:49 +01:00
* Account Import: if deleting or deactivating of deleted accounts is configured, run first import as a non-incremental one to do so
This commit is contained in:
parent
1777445b64
commit
fb6d64a8ed
@ -937,7 +937,9 @@ class Import
|
|||||||
const LOG_FILE = 'setup/account-import.log';
|
const LOG_FILE = 'setup/account-import.log';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run incremental import via async job
|
* Run import via async job
|
||||||
|
*
|
||||||
|
* First daily run is a full import, if deleting or deactivating accounts is configured, all others are incremental imports
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
@ -946,7 +948,8 @@ class Import
|
|||||||
try {
|
try {
|
||||||
$import = new self();
|
$import = new self();
|
||||||
$import->logger(date('Y-m-d H:i:s O').' LDAP account import started', 'info');
|
$import->logger(date('Y-m-d H:i:s O').' LDAP account import started', 'info');
|
||||||
$import->run(false);
|
$import->run(in_array($GLOBALS['egw_info']['server']['account_import_delete'] ?? 'no', ['yes', 'deactivate']) &&
|
||||||
|
self::firstRunToday());
|
||||||
$import->logger(date('Y-m-d H:i:s O').' LDAP account import finished', 'info');
|
$import->logger(date('Y-m-d H:i:s O').' LDAP account import finished', 'info');
|
||||||
}
|
}
|
||||||
catch (\InvalidArgumentException $e) {
|
catch (\InvalidArgumentException $e) {
|
||||||
@ -961,6 +964,21 @@ class Import
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if current time / run is the first one for today
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function firstRunToday()
|
||||||
|
{
|
||||||
|
if (empty($frequency=$GLOBALS['egw_info']['server']['account_import_frequency']))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// check current time <= time of first run today (frequency is in hours)
|
||||||
|
return time() <= mktime(ceil($frequency), round((60*$frequency)%60), 60); // 60 seconds grace time
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tail the async import log
|
* Tail the async import log
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user