summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorFrank Karlitschek <frank@owncloud.org>2012-10-08 11:53:00 +0200
committerFrank Karlitschek <frank@owncloud.org>2012-10-08 11:53:00 +0200
commitb7a5cc2fda1484e8a054820ef026bbaeccf31c77 (patch)
treed6a63aae4074fcbffc593f138a9b74aecd29d010 /lib
parent4dba91838ff24202fa7e184469074b61a4872d1e (diff)
downloadnextcloud-server-b7a5cc2fda1484e8a054820ef026bbaeccf31c77.tar.gz
nextcloud-server-b7a5cc2fda1484e8a054820ef026bbaeccf31c77.zip
use socket timeout of 10 sec to stay responsive even with a slow internet connection or a not working server
Diffstat (limited to 'lib')
-rw-r--r--lib/updater.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/updater.php b/lib/updater.php
index ad42f2bf605..b3b289ef276 100644
--- a/lib/updater.php
+++ b/lib/updater.php
@@ -42,7 +42,16 @@ class OC_Updater{
//fetch xml data from updater
$url=$updaterurl.'?version='.$versionstring;
- $xml=@file_get_contents($url);
+
+ // set a sensible timeout of 10 sec to stay responsive even if the update server is down.
+ $ctx = stream_context_create(
+ array(
+ 'http' => array(
+ 'timeout' => 10
+ )
+ )
+ );
+ $xml=@file_get_contents($url, 0, $ctx);
if($xml==FALSE) {
return array();
}