summaryrefslogtreecommitdiffstats
path: root/lib/util.php
diff options
context:
space:
mode:
authorThomas Tanghus <thomas@tanghus.net>2012-11-11 20:20:09 +0100
committerThomas Tanghus <thomas@tanghus.net>2012-11-11 20:20:09 +0100
commitfd709fc0217b2dc6b9b4a46aae4c9df721641084 (patch)
treebc98df9f93acc053aad2ec129f641f78a0575fef /lib/util.php
parent972ba89bc2abb8510810d814c08cc02c44ea533c (diff)
parent3be21cf6656342c4ef7713ee9b111b809122a709 (diff)
downloadnextcloud-server-fd709fc0217b2dc6b9b4a46aae4c9df721641084.tar.gz
nextcloud-server-fd709fc0217b2dc6b9b4a46aae4c9df721641084.zip
Merge branch 'master' of github.com:owncloud/core into vcategories_db
Diffstat (limited to 'lib/util.php')
-rwxr-xr-xlib/util.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/util.php b/lib/util.php
index 40b44bf9d6e..73b72bad1a5 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