Merge pull request #374 from lpszBuffer/master
Alters 'No Internet Connection' error message. #181
This commit is contained in:
commit
6da54a6987
3 changed files with 27 additions and 7 deletions
|
@ -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
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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>.',
|
||||
|
@ -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
|
||||
},
|
||||
{
|
||||
|
@ -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
|
||||
}
|
||||
]);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue