mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-10 09:04:26 +02:00
Update feed URL after permanent redirect
This commit is contained in:
parent
918317fa49
commit
31f103a1f0
5 changed files with 63 additions and 2 deletions
|
@ -167,12 +167,23 @@ class OnePoll
|
|||
$cookiejar = tempnam(System::getTempPath(), 'cookiejar-onepoll-');
|
||||
$curlResult = DI::httpClient()->get($contact['poll'], HttpClientAccept::FEED_XML, [HttpClientOptions::COOKIEJAR => $cookiejar, HttpClientOptions::REQUEST => HttpClientRequest::FEEDFETCHER]);
|
||||
unlink($cookiejar);
|
||||
Logger::debug('Polled feed', ['url' => $contact['poll'], 'http-code' => $curlResult->getReturnCode(), 'redirect-url' => $curlResult->getRedirectUrl()]);
|
||||
|
||||
if ($curlResult->isTimeout()) {
|
||||
Logger::notice('Polling timed out', ['id' => $contact['id'], 'url' => $contact['poll']]);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($curlResult->redirectIsPermanent()) {
|
||||
Logger::notice('Poll address permanently changed', [
|
||||
'id' => $contact['id'],
|
||||
'uid' => $contact['uid'],
|
||||
'old' => $contact['poll'],
|
||||
'new' => $curlResult->getRedirectUrl(),
|
||||
]);
|
||||
$success = Contact::updatePollUrl($contact['id'], $curlResult->getRedirectUrl());
|
||||
}
|
||||
|
||||
$xml = $curlResult->getBodyString();
|
||||
if (empty($xml)) {
|
||||
Logger::notice('Empty content', ['id' => $contact['id'], 'url' => $contact['poll']]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue