Finally dropped the hashing of the address

This commit is contained in:
Alejandro Celaya
2018-09-14 19:04:40 +02:00
parent ffb54c4f7a
commit 3d0bca2781
3 changed files with 13 additions and 49 deletions

View File

@@ -33,11 +33,6 @@ class Visit extends AbstractEntity implements \JsonSerializable
* @ORM\Column(type="string", length=256, name="remote_addr", nullable=true)
*/
private $remoteAddr;
/**
* @var string|null
* @ORM\Column(type="string", length=256, name="remote_addr_hash", nullable=true)
*/
private $remoteAddrHash;
/**
* @var string
* @ORM\Column(type="string", length=256, name="user_agent", nullable=true)
@@ -94,7 +89,7 @@ class Visit extends AbstractEntity implements \JsonSerializable
return $this;
}
public function getRemoteAddr(): string
public function getRemoteAddr(): ?string
{
return $this->remoteAddr;
}
@@ -102,8 +97,6 @@ class Visit extends AbstractEntity implements \JsonSerializable
public function setRemoteAddr(?string $remoteAddr): self
{
$this->remoteAddr = $this->obfuscateAddress($remoteAddr);
$this->remoteAddrHash = $this->hashAddress($remoteAddr);
return $this;
}
@@ -121,17 +114,6 @@ class Visit extends AbstractEntity implements \JsonSerializable
}
}
private function hashAddress(?string $address): ?string
{
return $address ? \hash('sha256', $address) : null;
}
public function resetObfuscatedAddr(): self
{
$this->remoteAddr = null;
return $this;
}
public function getUserAgent(): string
{
return $this->userAgent;
@@ -166,9 +148,11 @@ class Visit extends AbstractEntity implements \JsonSerializable
return [
'referer' => $this->referer,
'date' => isset($this->date) ? $this->date->format(\DateTime::ATOM) : null,
'remoteAddr' => $this->remoteAddr,
'userAgent' => $this->userAgent,
'visitLocation' => $this->visitLocation,
// Deprecated
'remoteAddr' => null,
];
}
}