diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2023-10-09 17:32:04 +0200 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2023-10-19 11:44:01 +0200 |
commit | bd370678210b69eedf4c579033ca2b60b897bd13 (patch) | |
tree | cebd90025f20aafc1425d6435afdc2ccfa557276 /apps/settings/lib/Controller | |
parent | 5503c4c8e2647ec43e2eff53438fc80ce92c60f0 (diff) | |
download | nextcloud-server-bd370678210b69eedf4c579033ca2b60b897bd13.tar.gz nextcloud-server-bd370678210b69eedf4c579033ca2b60b897bd13.zip |
Migrate InternetConnectivity check to new API
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps/settings/lib/Controller')
-rw-r--r-- | apps/settings/lib/Controller/CheckSetupController.php | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/apps/settings/lib/Controller/CheckSetupController.php b/apps/settings/lib/Controller/CheckSetupController.php index 1028d8ca202..9f2ba0e5bf6 100644 --- a/apps/settings/lib/Controller/CheckSetupController.php +++ b/apps/settings/lib/Controller/CheckSetupController.php @@ -193,54 +193,6 @@ class CheckSetupController extends Controller { } /** - * Checks if the server can connect to the internet using HTTPS and HTTP - * @return bool - */ - private function hasInternetConnectivityProblems(): bool { - if ($this->config->getSystemValue('has_internet_connection', true) === false) { - return false; - } - - $siteArray = $this->config->getSystemValue('connectivity_check_domains', [ - 'www.nextcloud.com', 'www.startpage.com', 'www.eff.org', 'www.edri.org' - ]); - - foreach ($siteArray as $site) { - if ($this->isSiteReachable($site)) { - return false; - } - } - return true; - } - - /** - * Checks if the Nextcloud server can connect to a specific URL - * @param string $site site domain or full URL with http/https protocol - * @return bool - */ - private function isSiteReachable(string $site): bool { - try { - $client = $this->clientService->newClient(); - // if there is no protocol, test http:// AND https:// - if (preg_match('/^https?:\/\//', $site) !== 1) { - $httpSite = 'http://' . $site . '/'; - $client->get($httpSite); - $httpsSite = 'https://' . $site . '/'; - $client->get($httpsSite); - } else { - $client->get($site); - } - } catch (\Exception $e) { - $this->logger->error('Cannot connect to: ' . $site, [ - 'app' => 'internet_connection_check', - 'exception' => $e, - ]); - return false; - } - return true; - } - - /** * Checks whether a local memcache is installed or not * @return bool */ @@ -906,7 +858,6 @@ Raw output 'isFairUseOfFreePushService' => $this->isFairUseOfFreePushService(), 'isBruteforceThrottled' => $this->throttler->getAttempts($this->request->getRemoteAddress()) !== 0, 'bruteforceRemoteAddress' => $this->request->getRemoteAddress(), - 'serverHasInternetConnectionProblems' => $this->hasInternetConnectivityProblems(), 'isMemcacheConfigured' => $this->isMemcacheConfigured(), 'memcacheDocs' => $this->urlGenerator->linkToDocs('admin-performance'), 'isRandomnessSecure' => $this->isRandomnessSecure(), |