diff options
author | Bjoern Schiessle <bjoern@schiessle.org> | 2016-08-08 14:56:24 +0200 |
---|---|---|
committer | Bjoern Schiessle <bjoern@schiessle.org> | 2016-08-09 10:24:45 +0200 |
commit | 50044fb79265f8c7cb3e204498d0097c62274f3e (patch) | |
tree | 08028787969ffe201ec5baf71c1d387a3364ac1e /apps/federation/lib/TrustedServers.php | |
parent | e4436e46cb38675fc14b608af094e4e3b5fa7c19 (diff) | |
download | nextcloud-server-50044fb79265f8c7cb3e204498d0097c62274f3e.tar.gz nextcloud-server-50044fb79265f8c7cb3e204498d0097c62274f3e.zip |
improve federation error messages
Diffstat (limited to 'apps/federation/lib/TrustedServers.php')
-rw-r--r-- | apps/federation/lib/TrustedServers.php | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/apps/federation/lib/TrustedServers.php b/apps/federation/lib/TrustedServers.php index fff19e414d5..f802af594dc 100644 --- a/apps/federation/lib/TrustedServers.php +++ b/apps/federation/lib/TrustedServers.php @@ -211,7 +211,7 @@ class TrustedServers { } /** - * check if URL point to a ownCloud server + * check if URL point to a ownCloud/Nextcloud server * * @param string $url * @return bool @@ -219,15 +219,21 @@ class TrustedServers { public function isOwnCloudServer($url) { $isValidOwnCloud = false; $client = $this->httpClientService->newClient(); - $result = $client->get( - $url . '/status.php', - [ - 'timeout' => 3, - 'connect_timeout' => 3, - ] - ); - if ($result->getStatusCode() === Http::STATUS_OK) { - $isValidOwnCloud = $this->checkOwnCloudVersion($result->getBody()); + try { + $result = $client->get( + $url . '/status.php', + [ + 'timeout' => 3, + 'connect_timeout' => 3, + ] + ); + if ($result->getStatusCode() === Http::STATUS_OK) { + $isValidOwnCloud = $this->checkOwnCloudVersion($result->getBody()); + + } + } catch (\Exception $e) { + $this->logger->debug('No Nextcloud server: ' . $e->getMessage()); + return false; } return $isValidOwnCloud; |