diff options
author | William Bargent <personal@williambargent.co.uk> | 2016-07-21 18:55:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-21 18:55:58 +0100 |
commit | 6da54a69872d18fb661b45f436f8e17633cc8547 (patch) | |
tree | 848bbf0902e7b3c8ecba66bd7de6cdf32addf22c /settings | |
parent | 562e63cf69fd56aea51bf9e1e591f4eeb5c395c5 (diff) | |
parent | b23610061940356aea920245e22246de6e14defb (diff) | |
download | nextcloud-server-6da54a69872d18fb661b45f436f8e17633cc8547.tar.gz nextcloud-server-6da54a69872d18fb661b45f436f8e17633cc8547.zip |
Merge pull request #374 from lpszBuffer/master
Alters 'No Internet Connection' error message. #181
Diffstat (limited to 'settings')
-rw-r--r-- | settings/Controller/CheckSetupController.php | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/settings/Controller/CheckSetupController.php b/settings/Controller/CheckSetupController.php index 7e30616d1f5..b801654f352 100644 --- a/settings/Controller/CheckSetupController.php +++ b/settings/Controller/CheckSetupController.php @@ -92,14 +92,34 @@ class CheckSetupController extends Controller { return false; } + $siteArray = ['www.nextcloud.com', + 'www.google.com', + 'www.github.com']; + + foreach($siteArray as $site) { + if ($this->isSiteReachable($site)) { + return true; + } + } + return false; + } + + /** + * Chceks if the ownCloud server can connect to a specific URL using both HTTPS and HTTP + * @return bool + */ + private function isSiteReachable($sitename) { + $httpSiteName = 'http://' . $sitename . '/'; + $httpsSiteName = 'https://' . $sitename . '/'; + try { $client = $this->clientService->newClient(); - $client->get('https://www.owncloud.org/'); - $client->get('http://www.owncloud.org/'); - return true; + $client->get($httpSiteName); + $client->get($httpsSiteName); } catch (\Exception $e) { return false; } + return true; } /** |