diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2012-11-09 02:11:24 -0800 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2012-11-09 02:11:24 -0800 |
commit | c0538636440b7293dd074ff4867bd950d426cea3 (patch) | |
tree | 73ed41289cd41024b0bef015a03bc610dd3b2ce5 /lib | |
parent | b33a44308858f8c8bdc0def5ac8ec8faa6da35c1 (diff) | |
parent | 55f75c6d8ee53122f950cdecd6409a1e8c9a5b28 (diff) | |
download | nextcloud-server-c0538636440b7293dd074ff4867bd950d426cea3.tar.gz nextcloud-server-c0538636440b7293dd074ff4867bd950d426cea3.zip |
Merge pull request #330 from owncloud/check_connection
add a check and a warning if the ownCloud server is not able to establis...
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/util.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/util.php b/lib/util.php index 40b44bf9d6e..8574ec31d83 100755 --- a/lib/util.php +++ b/lib/util.php @@ -584,6 +584,33 @@ class OC_Util { } } + + /** + * Check if the ownCloud server can connect to the internet + */ + public static function isinternetconnectionworking() { + + // try to connect to owncloud.org to see if http connections to the internet are possible. + $connected = @fsockopen("www.owncloud.org", 80); + if ($connected){ + fclose($connected); + return true; + }else{ + + // second try in case one server is down + $connected = @fsockopen("apps.owncloud.com", 80); + if ($connected){ + fclose($connected); + return true; + }else{ + return false; + } + + } + + } + + /** * @brief Generates a cryptographical secure pseudorandom string * @param Int with the length of the random string |