fix unhandled exception stalling LDAP/AD account sync

not (yet) fixing the cause, but logging it as error and continuing
This commit is contained in:
ralf 2023-02-21 11:17:11 +01:00
parent 96a18c8bf4
commit 6c917cd369

View File

@ -251,7 +251,7 @@ class Import
} }
else else
{ {
$this->logger("Error creaing user '$account[account_lid]' (#$account[account_id])", 'error'); $this->logger("Error creating user '$account[account_lid]' (#$account[account_id])", 'error');
$errors++; $errors++;
continue; continue;
} }
@ -284,7 +284,10 @@ class Import
$this->logger("Dry-run: would updated user '$account[account_lid]' (#$account_id): " . $this->logger("Dry-run: would updated user '$account[account_lid]' (#$account_id): " .
json_encode($diff, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), 'detail'); json_encode($diff, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), 'detail');
} }
elseif ($this->accounts_sql->save($to_update) > 0) else
{
try {
if ($this->accounts_sql->save($to_update) > 0)
{ {
// run editaccount hook to create eg. home-directory or mail account // run editaccount hook to create eg. home-directory or mail account
Api\Hooks::process($to_update+array( Api\Hooks::process($to_update+array(
@ -302,6 +305,14 @@ class Import
continue; continue;
} }
} }
catch (\Exception $e) {
$this->logger("Error updating user '$account[account_lid]' (#$account_id): ".$e->getMessage().' ('.$e->getCode().')', 'error');
$this->logger('$to_update='.json_encode($to_update, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), 'error');
$errors++;
continue;
}
}
}
else else
{ {
$this->logger("User '$account[account_lid]' (#$account_id) already up to date", 'debug'); $this->logger("User '$account[account_lid]' (#$account_id) already up to date", 'debug');