feat: use RDAP bootstrap file publication date

This commit is contained in:
Maël Gangloff
2024-08-19 18:38:14 +02:00
parent 0b0d4257da
commit f3eb055545

View File

@@ -438,19 +438,7 @@ readonly class RDAPService
/** /**
* @throws ORMException * @throws ORMException
*/ * @throws \Exception
public function updateRDAPServersFromFile(string $fileName): void
{
if (!file_exists($fileName)) {
return;
}
$this->logger->info('Start of update the RDAP server list from custom config file.');
$this->updateRDAPServers(Yaml::parseFile($fileName));
}
/**
* @throws ORMException
*/ */
private function updateRDAPServers(array $dnsRoot): void private function updateRDAPServers(array $dnsRoot): void
{ {
@@ -465,7 +453,10 @@ readonly class RDAPService
if (null === $server) { if (null === $server) {
$server = new RdapServer(); $server = new RdapServer();
} }
$server->setTld($tldReference)->setUrl($rdapServerUrl)->updateTimestamps(); $server
->setTld($tldReference)
->setUrl($rdapServerUrl)
->setUpdatedAt(new \DateTimeImmutable(array_key_exists('publication', $dnsRoot) ? $dnsRoot['publication'] : 'now'));
$this->em->persist($server); $this->em->persist($server);
} }
@@ -474,6 +465,19 @@ readonly class RDAPService
$this->em->flush(); $this->em->flush();
} }
/**
* @throws ORMException
*/
public function updateRDAPServersFromFile(string $fileName): void
{
if (!file_exists($fileName)) {
return;
}
$this->logger->info('Start of update the RDAP server list from custom config file.');
$this->updateRDAPServers(Yaml::parseFile($fileName));
}
/** /**
* @throws TransportExceptionInterface * @throws TransportExceptionInterface
* @throws ServerExceptionInterface * @throws ServerExceptionInterface