mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-12 01:54:26 +02:00
Remove contact immediately on 410 response code
This commit is contained in:
parent
946337645d
commit
2b617fc5c2
4 changed files with 44 additions and 0 deletions
|
@ -38,6 +38,8 @@ class GuzzleResponse extends Response implements ICanHandleHttpResponses, Respon
|
|||
private $isTimeout;
|
||||
/** @var boolean */
|
||||
private $isSuccess;
|
||||
/** @var boolean */
|
||||
private $isGone;
|
||||
/**
|
||||
* @var int the error number or 0 (zero) if no error
|
||||
*/
|
||||
|
@ -63,6 +65,7 @@ class GuzzleResponse extends Response implements ICanHandleHttpResponses, Respon
|
|||
$this->errorNumber = $errorNumber;
|
||||
|
||||
$this->checkSuccess();
|
||||
$this->checkGone();
|
||||
$this->checkRedirect($response);
|
||||
}
|
||||
|
||||
|
@ -86,6 +89,11 @@ class GuzzleResponse extends Response implements ICanHandleHttpResponses, Respon
|
|||
}
|
||||
}
|
||||
|
||||
private function checkGone()
|
||||
{
|
||||
$this->isGone = $this->getStatusCode() == 410;
|
||||
}
|
||||
|
||||
private function checkRedirect(ResponseInterface $response)
|
||||
{
|
||||
$headersRedirect = $response->getHeader(RedirectMiddleware::HISTORY_HEADER) ?? [];
|
||||
|
@ -135,6 +143,12 @@ class GuzzleResponse extends Response implements ICanHandleHttpResponses, Respon
|
|||
return $this->isSuccess;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public function isGone(): bool
|
||||
{
|
||||
return $this->isGone;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public function getUrl(): string
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue