Merge pull request #1891 from owncloud/set_timeout
use a 5 sec timeout for the webdav check
This commit is contained in:
commit
946a064fc6
10
lib/util.php
10
lib/util.php
|
@ -556,11 +556,16 @@ class OC_Util {
|
|||
if (!function_exists('curl_init')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$settings = array(
|
||||
'baseUri' => OC_Helper::linkToRemote('webdav'),
|
||||
);
|
||||
|
||||
// save the old timeout so that we can restore it later
|
||||
$old_timeout=ini_get("default_socket_timeout");
|
||||
|
||||
// use a 5 sec timeout for the check. Should be enough for local requests.
|
||||
ini_set("default_socket_timeout", 5);
|
||||
|
||||
$client = new \Sabre_DAV_Client($settings);
|
||||
|
||||
$return = true;
|
||||
|
@ -574,6 +579,9 @@ class OC_Util {
|
|||
$return = false;
|
||||
}
|
||||
|
||||
// restore the original timeout
|
||||
ini_set("default_socket_timeout", $old_timeout);
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue