mirror of
https://github.com/nextcloud/server.git
synced 2026-06-09 08:44:07 -04:00
Make code clearer for background host
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
4758bdc476
commit
406750552e
1 changed files with 8 additions and 8 deletions
|
|
@ -598,16 +598,16 @@ class Connection extends LDAPUtility {
|
|||
}
|
||||
}
|
||||
|
||||
$isOverrideMainServer = ($this->configuration->ldapOverrideMainServer
|
||||
|| $this->getFromCache('overrideMainServer'));
|
||||
$isBackupHost = (trim($this->configuration->ldapBackupHost) !== "")
|
||||
&& (!\OC::$CLI || !$this->configuration->ldapBackgroundHost);
|
||||
$forceBackupHost = ($this->configuration->ldapOverrideMainServer || $this->getFromCache('overrideMainServer'));
|
||||
$hasBackupHost = (trim($this->configuration->ldapBackupHost ?? '') !== '');
|
||||
$hasBackgroundHost = (trim($this->configuration->ldapBackgroundHost ?? '') !== '');
|
||||
$useBackupHost = $hasBackupHost && (!\OC::$CLI || !$hasBackgroundHost);
|
||||
$bindStatus = false;
|
||||
try {
|
||||
if (!$isOverrideMainServer) {
|
||||
if (!$forceBackupHost) {
|
||||
$host = $this->configuration->ldapHost;
|
||||
$port = $this->configuration->ldapPort;
|
||||
if (\OC::$CLI && $this->configuration->ldapBackgroundHost) {
|
||||
if (\OC::$CLI && $hasBackgroundHost) {
|
||||
$host = $this->configuration->ldapBackgroundHost;
|
||||
$port = $this->configuration->ldapBackgroundPort;
|
||||
}
|
||||
|
|
@ -615,7 +615,7 @@ class Connection extends LDAPUtility {
|
|||
return $this->bind();
|
||||
}
|
||||
} catch (ServerNotAvailableException $e) {
|
||||
if (!$isBackupHost) {
|
||||
if (!$useBackupHost) {
|
||||
throw $e;
|
||||
}
|
||||
$this->logger->warning(
|
||||
|
|
@ -627,7 +627,7 @@ class Connection extends LDAPUtility {
|
|||
}
|
||||
|
||||
//if LDAP server is not reachable, try the Backup (Replica!) Server
|
||||
if ($isBackupHost || $isOverrideMainServer) {
|
||||
if ($useBackupHost || $forceBackupHost) {
|
||||
$this->doConnect($this->configuration->ldapBackupHost,
|
||||
$this->configuration->ldapBackupPort);
|
||||
$this->bindResult = [];
|
||||
|
|
|
|||
Loading…
Reference in a new issue