diff options
author | Derek <derek.kelly27@gmail.com> | 2016-07-11 17:24:57 -0600 |
---|---|---|
committer | Derek Kelly <derek.kelly27@gmail.com> | 2016-07-20 19:12:10 -0500 |
commit | b23610061940356aea920245e22246de6e14defb (patch) | |
tree | 4f338ae51650321f81b629ab4c9dd2559409ecb9 /settings | |
parent | e8169e0d719ef8932bf30b56aad3925782d171bd (diff) | |
download | nextcloud-server-b23610061940356aea920245e22246de6e14defb.tar.gz nextcloud-server-b23610061940356aea920245e22246de6e14defb.zip |
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; } /** |