diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2018-10-17 13:09:11 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2018-10-18 17:49:28 +0200 |
commit | 8e4ae23c487b29bd8ea1a6d7d81e6996957e86fb (patch) | |
tree | 988f2f5d48e5e0cd958867849f36674245d8ee05 /apps/lookup_server_connector | |
parent | 7c8b3c1056d2549734ec4bb9ed547468ca2c2331 (diff) | |
download | nextcloud-server-8e4ae23c487b29bd8ea1a6d7d81e6996957e86fb.tar.gz nextcloud-server-8e4ae23c487b29bd8ea1a6d7d81e6996957e86fb.zip |
Do not try to contact lookup server without internet connection or URL
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/lookup_server_connector')
-rw-r--r-- | apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php | 12 | ||||
-rw-r--r-- | apps/lookup_server_connector/lib/UpdateLookupServer.php | 14 |
2 files changed, 21 insertions, 5 deletions
diff --git a/apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php b/apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php index c0fba230a26..5a7212a6522 100644 --- a/apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php +++ b/apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php @@ -50,9 +50,15 @@ class RetryJob extends Job { $this->clientService = $clientService; $this->jobList = $jobList; + if ($config->getSystemValue('has_internet_connection', true) === false) { + return; + } + $this->lookupServer = $config->getSystemValue('lookup_server', 'https://lookup.nextcloud.com'); - $this->lookupServer = rtrim($this->lookupServer, '/'); - $this->lookupServer .= '/users'; + if (!empty($this->lookupServer)) { + $this->lookupServer = rtrim($this->lookupServer, '/'); + $this->lookupServer .= '/users'; + } } /** @@ -69,7 +75,7 @@ class RetryJob extends Job { } protected function run($argument) { - if($argument['retryNo'] === 5) { + if ($argument['retryNo'] === 5 || empty($this->lookupServer)) { return; } diff --git a/apps/lookup_server_connector/lib/UpdateLookupServer.php b/apps/lookup_server_connector/lib/UpdateLookupServer.php index ae8fcbd67ca..7902ede8816 100644 --- a/apps/lookup_server_connector/lib/UpdateLookupServer.php +++ b/apps/lookup_server_connector/lib/UpdateLookupServer.php @@ -64,15 +64,25 @@ class UpdateLookupServer { $this->signer = $signer; $this->jobList = $jobList; + if($config->getSystemValue('has_internet_connection', true) === false) { + return; + } + $this->lookupServer = $config->getSystemValue('lookup_server', 'https://lookup.nextcloud.com'); - $this->lookupServer = rtrim($this->lookupServer, '/'); - $this->lookupServer .= '/users'; + if(!empty($this->lookupServer)) { + $this->lookupServer = rtrim($this->lookupServer, '/'); + $this->lookupServer .= '/users'; + } } /** * @param IUser $user */ public function userUpdated(IUser $user) { + if(empty($this->lookupServer)) { + return; + } + $userData = $this->accountManager->getUser($user); $publicData = []; |