mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-08-22 17:16:06 +00:00
Set a sane timeout for fetching the current DAViCal version
Without this it takes 90 seconds to timeout.
This commit is contained in:
parent
d42c3dc186
commit
216c253ad9
@ -267,9 +267,14 @@ function check_davical_version() {
|
||||
if ( ! ini_get('allow_url_fopen') )
|
||||
return new CheckResult( false, translate("Cannot determine upstream version, because PHP has set “<a href=\"https://secure.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen\"><code>allow_url_fopen</code></a>” to “<code>FALSE</code>”."), 'dep_warning' );
|
||||
$url = 'https://www.davical.org/current_davical_version?v='.$c->version_string;
|
||||
$version_file = @fopen($url, 'r');
|
||||
$version_context = stream_context_create( array(
|
||||
'http' => array(
|
||||
'timeout' => 2.0
|
||||
)
|
||||
));
|
||||
$version_file = @fopen($url, 'r', false, $version_context);
|
||||
if ( ! $version_file ) return new CheckResult( false, translate("Could not retrieve") . " '$url'", 'dep_warning' );
|
||||
$current_version = htmlentities( trim(fread( $version_file,12)) );
|
||||
$current_version = htmlentities( trim(fread( $version_file, 12)) );
|
||||
fclose($version_file);
|
||||
$result = new CheckResult($c->version_string == $current_version);
|
||||
if ( ! $result->getOK() ) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user