diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2022-11-17 14:55:55 +0100 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2022-12-19 14:15:46 +0100 |
commit | 4758bdc476f0b2ed981b40bff46239d2a64718fa (patch) | |
tree | 574fa86f5c9c41423a5143c3b040bceded02a0d7 /apps/user_ldap/lib/Connection.php | |
parent | 75e369d3069fea662af7ef41378f8ef4460e3ce1 (diff) | |
download | nextcloud-server-4758bdc476f0b2ed981b40bff46239d2a64718fa.tar.gz nextcloud-server-4758bdc476f0b2ed981b40bff46239d2a64718fa.zip |
Use a dedicated LDAP host and port for background jobs if configured
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps/user_ldap/lib/Connection.php')
-rw-r--r-- | apps/user_ldap/lib/Connection.php | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/apps/user_ldap/lib/Connection.php b/apps/user_ldap/lib/Connection.php index 0ebca44082e..a144810b39b 100644 --- a/apps/user_ldap/lib/Connection.php +++ b/apps/user_ldap/lib/Connection.php @@ -600,12 +600,18 @@ class Connection extends LDAPUtility { $isOverrideMainServer = ($this->configuration->ldapOverrideMainServer || $this->getFromCache('overrideMainServer')); - $isBackupHost = (trim($this->configuration->ldapBackupHost) !== ""); + $isBackupHost = (trim($this->configuration->ldapBackupHost) !== "") + && (!\OC::$CLI || !$this->configuration->ldapBackgroundHost); $bindStatus = false; try { if (!$isOverrideMainServer) { - $this->doConnect($this->configuration->ldapHost, - $this->configuration->ldapPort); + $host = $this->configuration->ldapHost; + $port = $this->configuration->ldapPort; + if (\OC::$CLI && $this->configuration->ldapBackgroundHost) { + $host = $this->configuration->ldapBackgroundHost; + $port = $this->configuration->ldapBackgroundPort; + } + $this->doConnect($host, $port); return $this->bind(); } } catch (ServerNotAvailableException $e) { |