change the cURL success check and adopt the logger messages

This commit is contained in:
Tobias Diekershoff 2022-11-06 09:03:11 +01:00
parent fb04eb107b
commit 33c9d17bdb

View file

@ -61,9 +61,7 @@ class CheckRelMeProfileLink
if (!empty($owner['homepage'])) { if (!empty($owner['homepage'])) {
$xrd_timeout = DI::config()->get('system', 'xrd_timeout', 20); $xrd_timeout = DI::config()->get('system', 'xrd_timeout', 20);
$curlResult = DI::httpClient()->get($owner['homepage'], $accept_content = HttpClientAccept::HTML, [HttpClientOptions::TIMEOUT => $xrd_timeout]); $curlResult = DI::httpClient()->get($owner['homepage'], $accept_content = HttpClientAccept::HTML, [HttpClientOptions::TIMEOUT => $xrd_timeout]);
if ($curlResult->isTimeout()) { if ($curlResult->isSuccess()) {
Logger::notice('Could not check homepage link of the user because the page loading request timed out.', [$uid, $owner['homepage']]);
} else {
$content = $curlResult->getBody(); $content = $curlResult->getBody();
if (!$content) { if (!$content) {
Logger::notice('Empty body of the fetched homepage link). Cannot verify the relation to profile of UID %s.', [$uid, $owner['homepage']]); Logger::notice('Empty body of the fetched homepage link). Cannot verify the relation to profile of UID %s.', [$uid, $owner['homepage']]);
@ -90,6 +88,8 @@ class CheckRelMeProfileLink
Logger::notice('Homepage URL could not be verified', [$uid, $owner['homepage']]); Logger::notice('Homepage URL could not be verified', [$uid, $owner['homepage']]);
} }
} }
} else {
Logger::notice('Could not cURL the homepage URL', [$owner['homepage']]);
} }
} else { } else {
Logger::notice('The user has no homepage link.', [$uid]); Logger::notice('The user has no homepage link.', [$uid]);