From c0e1f47b48cfae77ac4aae5aabd005eca179eae6 Mon Sep 17 00:00:00 2001 From: ralf Date: Fri, 18 Aug 2023 09:21:18 +0200 Subject: [PATCH] commented out patch to reconnect to LDAP server, if connection is lost --- api/src/Accounts/Import.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/api/src/Accounts/Import.php b/api/src/Accounts/Import.php index 9f4c5ecb85..5442852bab 100644 --- a/api/src/Accounts/Import.php +++ b/api/src/Accounts/Import.php @@ -273,6 +273,7 @@ class Import $start = ['', 500, &$cookie]; // cookie must be a reference! do { + $contact = $reconnected = null; foreach ($this->contacts->search('', false, '', 'account_lid', '', '', 'AND', $start, $filter) as $contact) { $new = null; @@ -532,8 +533,15 @@ class Import // remember the users we imported, to be able to delete the ones we dont unset($sql_users[$account_id]); } + /* check if connection was somehow lost / timed out and reconnect + if ($initial_import && !isset($contact) && ldap_errno($this->contacts->ds) === -1) + { + $this->contacts->ds = $this->accounts->ldap_connection(true); + $reconnected = true; + $this->logger("Reconnected to LDAP server", 'info'); + }*/ } - while ($start[2] !== ''); + while ($reconnected || $start[2] !== ''); if ($set_members) {