[refactoring] replace direct use of curl with getContents (#3723)

+ some fixed warnings
This commit is contained in:
User123698745 2023-10-01 20:46:51 +02:00 committed by GitHub
parent 41df17bc46
commit 69da0dd583
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 52 deletions

View file

@ -52,7 +52,11 @@ function getContents(
$config['proxy'] = Configuration::getConfig('proxy', 'url');
}
$cacheKey = 'server_' . $url;
$requestBodyHash = null;
if (isset($curlOptions[CURLOPT_POSTFIELDS])) {
$requestBodyHash = md5(json_encode($curlOptions[CURLOPT_POSTFIELDS]));
}
$cacheKey = implode('_', ['server', $url, $requestBodyHash]);
/** @var Response $cachedResponse */
$cachedResponse = $cache->get($cacheKey);