mirror of
https://github.com/silverstripe/silverstripe-fulltextsearch
synced 2024-10-22 14:05:29 +02:00
Close curl handles after use
This commit is contained in:
parent
94bb78fc7f
commit
fbe899e85f
@ -22,6 +22,7 @@
|
|||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=7.1",
|
"php": ">=7.1",
|
||||||
|
"ext-curl": "*",
|
||||||
"silverstripe/framework": "^4.0",
|
"silverstripe/framework": "^4.0",
|
||||||
"monolog/monolog": "~1.15",
|
"monolog/monolog": "~1.15",
|
||||||
"ptcinc/solr-php-client": "^1.0",
|
"ptcinc/solr-php-client": "^1.0",
|
||||||
|
@ -23,9 +23,13 @@ class WebDAV
|
|||||||
|
|
||||||
$ch = self::curl_init($url, 'PROPFIND');
|
$ch = self::curl_init($url, 'PROPFIND');
|
||||||
|
|
||||||
$res = curl_exec($ch);
|
curl_exec($ch);
|
||||||
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
|
||||||
|
$err = curl_error($ch);
|
||||||
|
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
if ($code == 404) {
|
if ($code == 404) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -33,8 +37,6 @@ class WebDAV
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$err = curl_error($ch);
|
|
||||||
|
|
||||||
user_error("Got error from webdav server - " . $err, E_USER_ERROR);
|
user_error("Got error from webdav server - " . $err, E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,8 +44,9 @@ class WebDAV
|
|||||||
{
|
{
|
||||||
$ch = self::curl_init(rtrim($url, '/') . '/', 'MKCOL');
|
$ch = self::curl_init(rtrim($url, '/') . '/', 'MKCOL');
|
||||||
|
|
||||||
$res = curl_exec($ch);
|
curl_exec($ch);
|
||||||
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
return $code == 201;
|
return $code == 201;
|
||||||
}
|
}
|
||||||
@ -58,10 +61,12 @@ class WebDAV
|
|||||||
|
|
||||||
curl_setopt($ch, CURLOPT_INFILE, $handle);
|
curl_setopt($ch, CURLOPT_INFILE, $handle);
|
||||||
|
|
||||||
$res = curl_exec($ch);
|
curl_exec($ch);
|
||||||
fclose($handle);
|
fclose($handle);
|
||||||
|
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
return curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
return $code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function upload_from_string($string, $url)
|
public static function upload_from_string($string, $url)
|
||||||
|
Loading…
Reference in New Issue
Block a user