diff options
author | Frank Karlitschek <frank@owncloud.org> | 2012-11-08 18:08:44 +0100 |
---|---|---|
committer | Frank Karlitschek <frank@owncloud.org> | 2012-11-08 18:08:44 +0100 |
commit | 55f75c6d8ee53122f950cdecd6409a1e8c9a5b28 (patch) | |
tree | 69a2a60aa737f1e11a48952f508ca2e8aabb976d /lib | |
parent | 8396c0478e930d58a45749dbbd96a517279b3b4d (diff) | |
download | nextcloud-server-55f75c6d8ee53122f950cdecd6409a1e8c9a5b28.tar.gz nextcloud-server-55f75c6d8ee53122f950cdecd6409a1e8c9a5b28.zip |
add a check and a warning if the ownClodu server is not able to establish http connections to the internet. The reason is that users complained that external filesystem support, the update checker, downloading of new apps or the nowledgebase don´t work and don´t know why.
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 |