summaryrefslogtreecommitdiffstats
path: root/apps/lookup_server_connector
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2018-10-17 13:09:11 +0200
committerArthur Schiwon <blizzz@arthur-schiwon.de>2018-10-18 17:49:28 +0200
commit8e4ae23c487b29bd8ea1a6d7d81e6996957e86fb (patch)
tree988f2f5d48e5e0cd958867849f36674245d8ee05 /apps/lookup_server_connector
parent7c8b3c1056d2549734ec4bb9ed547468ca2c2331 (diff)
downloadnextcloud-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.php12
-rw-r--r--apps/lookup_server_connector/lib/UpdateLookupServer.php14
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 = [];