mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
feat: add app:batch-register-domains command
This commit is contained in:
@@ -67,6 +67,13 @@ final readonly class UpdateDomainHandler
|
||||
public function __invoke(UpdateDomain $message): void
|
||||
{
|
||||
$domain = $this->domainRepository->findOneBy(['ldhName' => $message->ldhName]);
|
||||
|
||||
if (null === $domain) {
|
||||
$this->RDAPService->registerDomain($message->ldhName);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var ?RdapServer $rdapServer */
|
||||
$rdapServer = $domain->getTld()->getRdapServers()->first();
|
||||
if (null === $rdapServer) {
|
||||
@@ -79,6 +86,15 @@ final readonly class UpdateDomainHandler
|
||||
|
||||
$watchlist = $this->watchlistRepository->findOneBy(['token' => $message->watchlistToken]);
|
||||
|
||||
if (null === $watchlist) {
|
||||
/** @var Watchlist $wl */
|
||||
foreach ($domain->getWatchlists()->getIterator() as $wl) {
|
||||
$this->bus->dispatch(new UpdateDomain($message->ldhName, $wl->getToken()));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$this->RDAPService->isToBeUpdated($domain, false, null !== $watchlist->getConnector())) {
|
||||
$this->logger->debug('The domain name is already present in the database and does not need to be updated at this time', [
|
||||
'ldhName' => $domain->getLdhName(),
|
||||
|
||||
Reference in New Issue
Block a user