Skip to content

Commit

Permalink
Merge pull request #374 from lpszBuffer/master
Browse files Browse the repository at this point in the history
Alters 'No Internet Connection' error message. #181
  • Loading branch information
William Bargent authored Jul 21, 2016
2 parents 562e63c + b236100 commit 6da54a6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
2 changes: 1 addition & 1 deletion core/js/setupchecks.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
if (xhr.status === 200 && data) {
if (!data.serverHasInternetConnection) {
messages.push({
msg: t('core', 'This server has no working Internet connection. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. We suggest to enable Internet connection for this server if you want to have all features.'),
msg: t('core', 'This server has no working Internet connection: Multiple endpoints could not be reached. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. We suggest to enable Internet connection for this server if you want to have all features.'),
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
});
}
Expand Down
6 changes: 3 additions & 3 deletions core/js/tests/specs/setupchecksSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ describe('OC.SetupChecks tests', function() {
async.done(function( data, s, x ){
expect(data).toEqual([
{
msg: 'This server has no working Internet connection. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. We suggest to enable Internet connection for this server if you want to have all features.',
msg: 'This server has no working Internet connection: Multiple endpoints could not be reached. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. We suggest to enable Internet connection for this server if you want to have all features.',
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
}, {
msg: 'No memory cache has been configured. To enhance your performance please configure a memcache if available. Further information can be found in our <a target="_blank" rel="noreferrer" href="https://doc.owncloud.org/server/go.php?to=admin-performance">documentation</a>.',
Expand Down Expand Up @@ -192,7 +192,7 @@ describe('OC.SetupChecks tests', function() {
async.done(function( data, s, x ){
expect(data).toEqual([
{
msg: 'This server has no working Internet connection. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. We suggest to enable Internet connection for this server if you want to have all features.',
msg: 'This server has no working Internet connection: Multiple endpoints could not be reached. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. We suggest to enable Internet connection for this server if you want to have all features.',
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
},
{
Expand Down Expand Up @@ -224,7 +224,7 @@ describe('OC.SetupChecks tests', function() {
async.done(function( data, s, x ){
expect(data).toEqual([
{
msg: 'This server has no working Internet connection. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. We suggest to enable Internet connection for this server if you want to have all features.',
msg: 'This server has no working Internet connection: Multiple endpoints could not be reached. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. We suggest to enable Internet connection for this server if you want to have all features.',
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
}
]);
Expand Down
26 changes: 23 additions & 3 deletions settings/Controller/CheckSetupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,34 @@ private function isInternetConnectionWorking() {
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;
}

/**
Expand Down

0 comments on commit 6da54a6

Please sign in to comment.